File::ReadBackwardsuse File::ReadBackwards () my $fh_in = File::ReadBackwards->new($ARGV[0]) or die("Unable to open the data file: $!\n"); open(my $fh_out, '>', $ARGV[1]) or die("Unable to create output file: $!\n"); local $_; my $last = 1; while (defined($_ = $fh_in->readline())) { if ($last) { s/different/regex here/; } else { s/yada/yadda/; } print $fh_out $_; $last = 0; }
Update: Nevermind, the output file will end up being backwards. If only there was a File::WriteBackwards module ;)
In reply to Re: While.For loop noob query
by ikegami
in thread While.For loop noob query
by jriggs420
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |