in reply to Re: Use an incrementing counter as a variable (arrays)
in thread Use an incrementing counter as a variable
Anonymous one: Variations on this approach are
where junk_1.txt containsc:\@Work\Perl\monks\Anonymous Monk\1199083>perl -wMstrict -MData::Dump + -le "my @bin; ;; while(my $line = <>) { push @bin, $line; } ;; dd \@bin; " junk_1.txt ["line uno\n", "line two\n", "line 3\n"] c:\@Work\Perl\monks\Anonymous Monk\1199083>perl -wMstrict -MData::Dump + -le "my @bin = <>; ;; dd \@bin; " junk_1.txt ["line uno\n", "line two\n", "line 3\n"]
Both these variations relieve you of the need to maintain the $counter counter (assuming it's initialized to 0).line uno line two line 3
Give a man a fish: <%-{-{-{-<
|
|---|