#!/usr/bin/perl -w use strict; =pod Maybe somthing like this is what you want =cut
open IN, "$ARGV[0]" or die "Damn $ARGV[0]: $!"; while (<IN>){ chomp; my @stats = split /\|/, $_; print "@stats\n" if $stats[2] and $stats[2] =~ /^\d+$/ and $stats[2] > 300; } close IN or die "Doh $!"; # \Stefan __END__ > I am doing an assignment. I am writing a script to access a file and > print the first and last name of workers whose hours worked exceeded > 300hours. In the file, the last name is the first field and the first > name > is the second field. Both fields are separated by the "|" operator. > > #!/usr/bin/perl > > # use warnings; > > #use strict; > unless ($worker_hour =~ i < 300) { > print "@payroll [1][0]; > } > > Am I printing the output the right way or is there another way? > > Thanks > > a copy of the file is attached. > > Do you Yahoo!? > Yahoo! Tax Center - forms, calculators, tips, and more > > StRegis|Les|300|15.26|Courtland|NM|216|723-6122 > Zissily|Jeb|296|35.21|Elfrieda|AZ|711|574-5587 > Brown|Rubin|231|10.14|Lochiel|CA|703|511-3745 > Jarvis|Sue|340|15.15|Gleason|AZ|520|356-1210 > Atara|Frieda|245|25.29|Courtland|NM|216|794-3876 > Smith|Samuel|343|12.36|Sunnyside|AZ|314|457-7989 > Jones|Omar|102|42.22|Harshawk|AZ|602|294-7034 > Mason|Alice|221|21.28|Elfrieda|AZ|711|654-4458 > Winnet|Alex|346|32.19|Fairbank|AK|908|632-3151 > Smith|David|450|43.43|Sierra Vista|AZ|520|487-7989 > Mason|Jimbo|334|14.37|Gleason|AZ|520|378-4458 > Stark|Bonnie|340|18.16|Lochiel|CA|703|535-52032 > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]