in reply to read a file twice...

You can "read" it as many times as you want if you stuff it into an array just once:

open F, "some_file" or die $!"; my @lines = <F>; close F; for (@lines) { # .. find the max and minimum } for (@lines) { # .. do something before / after those indexes }

Update: Oops. s/\@f/\@lines/g; as MeowChow pointed out to me.

perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&V"+@( NO CARRIER'