in reply to line numbers and line content into hash
open INFILE, "<", '/var/tmp/infile' or die "ack! no infile: $!"; @slurp = <INFILE>; close INFILE; print "This is line 5:", $slurp[5-1], "\n"; # arrays start index at 0 so subtract # one from the line number to get the array index. print "This is line 12:", $slurp[12-1], "\n";
|
|---|