I just want to preserve $_ deeper within the while{} block
The code shown has no effect on $_. Did you mean $1? If so, I can’t see any problem with using $1 at the top of the loop, then redefining it lower down as needed. However, if you do want to dispense with $1, you could use a named capture:
while ($data =~ /^(?<line>.*)$/gm) { print "<3>" . $+{line} . "\n"; }
See Capture groups.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: While behavior
by Athanasius
in thread While behavior
by SavannahLion
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |