# Open the file containing data or abort with error message open(my $fh, "<", "some_file.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"; } } #### # Assign only the columns you're interested in my ($timePoints,$diffPoints,$name) = +(split(/\s+/,$line,13))[3,11,14]; #### # Ensure the line consists of 12 integers + something my ( ... ) = ($line =~ /^\s*(?:(\d+)\s*){12}(.*)/); #### next unless $line =~ /(intrepid|triumph)/; my ( ... ) = ...; print ....;