in reply to When One Line Becomes Three
open IN_FILE, "<$filename" or die "Cannot open $filename for reading\n +"; my @file = <IN_FILE>; close IN_FILE; for (my $i = 0; $i < $#file; $i++) { # Do your stuff here. # If you end up changing the number of lines, back up $i and # go through indices again. }
Warning: You actually have to think through your algorithm and figure out all the possibilities and not just code off the cuff like most of us are used to doing. (Heavens forfend! I have to think?!?)
|
|---|