in reply to Searching for Certain Values
#!/usr/local/bin/perl open(my $fh, "<", "data.txt") || die "Can't open file: $!"; # Run through all lines of the file, one by one while(my $line = <$fh>) { # Break up the line on whitespace, assign columns to vars my( $score,$scorePoints, $time,$timePoints, $record,$recordPoints, $size,$sizePoints, $age,$agePoints, $diff,$diffPoints, $size2,$size2Points, $name ) = split(/\s+/,$line,13); # Check to see if name matches if($name =~ /(intrepid|triumph)/) { print "$name\n", "Time: $timePoints, Difficulty: $diffPoints\n\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Searching for Certain Values
by johngg (Canon) on Jul 30, 2007 at 22:14 UTC | |
by Dr.Avocado (Novice) on Jul 30, 2007 at 22:47 UTC | |
|
Re^2: Searching for Certain Values
by Dr.Avocado (Novice) on Jul 30, 2007 at 22:10 UTC |