in reply to Re: How do I parse and evaluate a file line-by-line?
in thread How do I parse and evaluate a file line-by-line?
The $cursor variable is unnecessary, because Perl always knows how long the array is.while (<DATA>) { my ($time, $switch) = split "\t"; if ($switch eq $last) { $output[-1] = $_; } else { push @output, $_; $last = $switch; } }
-- Randal L. Schwartz, Perl hacker
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: How do I parse and evaluate a file line-by-line?
by Trimbach (Curate) on Mar 03, 2001 at 20:57 UTC |