in reply to line numbers and line content into hash
Are you doing something like this?
Nothing wrong with that.my %hash $hash{$.} = $_ while <>;
Why not use an array, though? my @lines = <>; The line number is implicit in the array index, and no sorting is needed.
You can grep over the array as much as you wish and still get line numbers (minus 1), my @matched_idxs = grep {$lines[$_] =~ /$re/} 0 .. $#lines; and that array can be used in a slice or a pretty-printing loop.
After Compline,
Zaxo
|
|---|