Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- open LIST1, "list1.txt" or die $!;
- open LIST2, "list2.txt" or die $!;
- open LIST3, "list3.txt" or die $!;
- $list1 = {};
- $list2 = {};
- $list3 = {};
- while (<LIST1>) {
- $rec = {};
- ($num, $name, $position, $department) = split(/, /, $_);
- chomp($department);
- $rec->{"name"} = $name;
- $rec->{"position"} = $position;
- $rec->{"department"} = $department;
- $list1{$num} = $rec;
- }
- while (<LIST2>) {
- $rec = {};
- ($name, $num, $address, $tel_no, $ss_no) = split(/, /, $_);
- $rec->{"name"} = $name;
- $rec->{"address"} = $address;
- $rec->{"tel_no"} = $tel_no;
- $rec->{"ss_no"} = $ss_no;
- $list2{$num} = $rec;
- }
- while (<LIST3>) {
- $rec = {};
- ($num, $ss_no, $salary) = split(/, /, $_);
- $rec->{"ss_no"} = $ss_no;
- $rec->{"salary"} = $salary;
- $list3{$num} = $rec;
- }
- foreach $num ( %list3 ) {
- if ($list3{$num}{"salary"} > 2000) {
- print "Name: ".$list1{$num}{"name"}."\n";
- print "Address: ".$list2{$num}{"address"}."\n";
- print "Department: ".$list1{$num}{"department"}."\n";
- print "Salary: £".$list3{$num}{"salary"}."\n";
- }
- }
Add Comment
Please, Sign In to add comment