Perl Monk, Perl Meditation | |
PerlMonks |
Doesn't seem completeby tlhf (Scribe) |
on Jun 29, 2002 at 16:21 UTC ( [id://178247]=note: print w/replies, xml ) | Need Help?? |
Okay, so we've got;
Which is cute. Except it fails under some conditions. Let's say you want to give the variable 'foo' the value of 'moo shoo= coo'. I'd assume it would be written 'foo=moo shoo\= coo'. Except your example doesn't allow for this. So I tried a little, and this is what I got; I was working from the param line as a single scalar variable for simplicity, and my first efforts seemed moderately successful;
However, this system has the problem of only checking whether the previous character is a backslash - it doesn't allow for backslashed backslahes. The expression would need to understand that '\\=' signified a backslash and then a non-escape literal. But it couldn't just check for two slashes and cancel, for it should accept '\\\=' as a a backslashed backslash and a backslashed equals symbol. It would, effectively, need to look behind for an even number of slashes, and only slash on that. I had; @pairs = split(/(?<!(\\\\+))\s/, $line); Which seemed perfect. Except we're not allowed variable length lookbehind, because it's not been implemented yet. Which was very annoying to find out. So, we could match the proceeding backslashes normally, but strap them back on. But that would be horrible. I have tried further routes, but found nothing. *sigh* tlhf xxx
In Section
Seekers of Perl Wisdom
|
|