perlcgi has asked for the wisdom of the Perl Monks concerning the following question:
I'm processing very large text files of delimited records, and localizing $/ to be my delimiter works great.
However, I don't like having $/ altered for the scope of the entire while-loop 'cos that's pretty much my whole program and it could have consequences for the subroutines within the loop. I'm seeking a nice idiom to return it to its previous value, after it has done it's thing, for each iteration. Suggestions much appreciated.{local $/ = "DELIMITER"; while( <FILE> ){ do_this(); do_that(); do_the_other(); } }
|
---|
Replies are listed 'Best First'. | |
---|---|
•Re: Seeking an idiom for localizing $/
by merlyn (Sage) on Apr 29, 2004 at 15:29 UTC | |
by perlcgi (Hermit) on Apr 29, 2004 at 15:47 UTC | |
by merlyn (Sage) on Apr 29, 2004 at 15:50 UTC | |
by fizbin (Chaplain) on Apr 29, 2004 at 17:10 UTC | |
by EdwardG (Vicar) on Apr 29, 2004 at 17:55 UTC | |
| |
| |
Re: Seeking an idiom for localizing $/
by ihb (Deacon) on Apr 30, 2004 at 00:25 UTC |
Back to
Seekers of Perl Wisdom