Think about Loose Coupling | |
PerlMonks |
Re: String Substitution Operatorby TheHobbit (Pilgrim) |
on Oct 23, 2003 at 09:10 UTC ( [id://301506]=note: print w/replies, xml ) | Need Help?? |
Hi, Obviously,
does not what that wanna be reference says. Infact, it also is semanticaly wrong, $2 and $3 being undefined in the replacement part: the matching part of the s/// operator contains only one pair of parenthesis, so that only $1 is defined. The sobstitution you propose almost does the work. I say almost because:
a third problem (that could be disregarded) is that the /x option is useless, since there are nor spaces nor comments in the regex. A simpler way to to that would be to use the tr/// operator, like in
Obvously, all this still lets you short of an useful example about how and why use the /x option in matching operators. I'm sorry, but I have none to offer to you now, may be later, when I'll be at home with all my little files at hand... Hoping that this helps... Leo TheHobbit
In Section
Seekers of Perl Wisdom
|
|