Re: $_
From: Eric Walker (ewalker_at_micron.com)
Date: 12/30/03
- Next message: Dan Muey: "RE: $_"
- Previous message: Kevin Old: "Cosolidate multiple regular expression"
- In reply to: James Edward Gray II: "Re: $_"
- Next in thread: Dan Muey: "RE: $_"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: James Edward Gray II <james@grayproductions.net> Date: 30 Dec 2003 09:48:02 -0700
Once I get into the while loop the previous line I had is lost. As this
while is underneath another while that I am using in another routine.
thanks
On Tue, 2003-12-30 at 09:42, James Edward Gray II wrote:
On Dec 30, 2003, at 10:36 AM, Eric Walker wrote:
> I am going through a file and when I enter a certain routine, I am
> entering a while loop with the <IN> construct. Is there a way to back
> the counter up or back up one line before I go into the while loop?
>
> a
> b
> c
> d
>
> Instead of seeing b when I enter the while loop, adjust some option and
> see the a.
How about adding:
my $last;
while (<IN>) {
# use $last here, but watch for undef on the first iteration, for
example:
do_something( $last ) if defined $last;
$last = $_;
}
Hope that helps.
James
- Next message: Dan Muey: "RE: $_"
- Previous message: Kevin Old: "Cosolidate multiple regular expression"
- In reply to: James Edward Gray II: "Re: $_"
- Next in thread: Dan Muey: "RE: $_"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|