in reply to Re: Processing lines after a pattern in a while loop
in thread Processing lines after a pattern in a while loop
To echo what tilly said, don't use 'flag' for a variable name unless you're talking about a square or rectangle of cloth. Why not something more interesting like $seenJunkYet instead?
I'd rather go for something like
That way there aren't any flag variables. It's more lines of code, but it reads more easily.# Skip header junk while(<>) { last if /end of header junk/; } # Start processing real data while(<>) { # But quit if we see junk starting up again last if /start of trailer junk/; # Do useful stuff here }
Alex / talexb / Toronto
Life is short: get busy!
|
|---|