in reply to While behavior

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,

Replies are listed 'Best First'.
Re^2: While behavior
by SavannahLion (Pilgrim) on Feb 15, 2014 at 04:55 UTC

    Oh sorry, you're absolutely right. That was a bad edit. I'd blame my right hand fingers being bound up, but it's just sloppy proof reading. :\
    Yes, I really meant $1. The code I culled out reuses the string captured in $1 because I'm having problems crafting a single line Regex that parses the string correctly (A subject for a different posting). I was trying to fix that bug when I came across this bug.
    Now that I understand why I have this bug, I can focus on that bug. :)