First off it's wrong to use qr// on rhs of s///
You must realize that the left side of s///
is the regular expression, and that the right side is
merely the the substitute string ( or that which produces
the substitute string)
So in effect what you are doing is:
- $var =~ s/ < regex $expr > / < scalar representation of $sub > /
This is why you end up with the string (?-xism: spooge),
which is the scalar value of $sub
In the node you referred to, they eval'ed
the rhs one way or the other. mdillon eval'ed
the rhs only ( $1 . "ar" ) by using /ee ( read perlop ), and
knight eval'ed the entire perl expression
( "s/$lhs/$rhs/" ).
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.