Mr John Doe R&D 21000 Miss Gloria Dunne HR 23000 Mr Jack Stevens HR 45000 Mrs Julie Fay R&D 30000 Mr Patrick Reed R&D 33000 #### #!/usr/bin/perl #open the employeesfile open (EMPLOYEES,"employees.txt") or die "Tough: $!\n\n"; #for each line while ($line = ) { #remove the carriage return chomp $line; #split the line between tabs #and get the different elements ($name,$department, $salary) = split /\t/, $line; #go to the next line unless the name starts with "Mr " next unless$name =~ /^Mr /; #go to the next line unless the salary is more than 25000. next unless$salary > 5000; #go to the next line unless the department is R&D. next unless$department eq $ARGV[0]; #since all employees here are male, #remove the particle in front of their name $name =~ s/Mr//; print"$name\n"; print"$department\n"; print"$salary\n"; } close (EMPLOYEES);