Yes the wording is odd, but like a lot of perl docs, if you keep reading you will get all the details, like: A second e modifier will cause the replacement portion to be evaled before being run as a Perl expression.
I once wrote
- s/regex/STRING /e
- means replace that matched by regex with string
- s/regex/CODEHERE/e
- means replace that matched by regex with result of code; the e in s///e tells the s///ubstitution operator that the s//CODEHERE/e is code and not a string
- s/regex/CODEHERE/e
- means treat CODEHERE string as code
- s/regex/CODEHERE/ee
- means treat CODEHERE string as code, and treat the return value of that code as code
- s/regex/CODEHERE/ee
- means s/regex/eval CODEHERE/e
One time I even tried to explain this way :)
my $string = 'string';
## s/string/replacement/;
$string->substitute( 'pattern', 'replacement' );
## s/string/codehere/e;
$string->substitute( 'pattern', sub { ... } );
## s/string/codehere/ee;
$string->substitute( 'pattern', sub { eval ... } );
## s/string/codehere/eee;
$string->substitute( 'pattern', sub { eval eval ... } );
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.