jgallagher has asked for the wisdom of the Perl Monks concerning the following question:
What I need to do is read the file until I reach the "aaaa" at the end of the line and then change the $/ to be % instead of \n. I tried this:XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXaaaa abcdefghijklm%nopqrstuvw%xyz
If the second while is in there, nothing happens inside of it, and without it, the loop does not cycle back again. Any suggestions?while (<FILE>) { if (/aaaa$/) { $/ = '%'; while (<FILE>) {} # I tried it with and without this loop } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Changing $/ mid-file
by mirod (Canon) on Jan 17, 2001 at 04:33 UTC | |
|
Re: Changing $/ mid-file
by eg (Friar) on Jan 17, 2001 at 04:35 UTC | |
|
Re: Changing $/ mid-file
by I0 (Priest) on Jan 17, 2001 at 06:37 UTC | |
by dkubb (Deacon) on Jan 17, 2001 at 07:30 UTC | |
|
Re: Changing $/ mid-file
by Coyote (Deacon) on Jan 17, 2001 at 04:36 UTC | |
|
Re: Changing $/ mid-file
by Anonymous Monk on Jan 17, 2001 at 10:00 UTC | |
by Corion (Patriarch) on Jan 17, 2001 at 13:28 UTC |