laziness, impatience, and hubris | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
ok, here goes...
the / means just that, match a forward slash So, if your string ends with a / it will be matched, and replaced with another slash, with no net effect. However, if your script doesn't end with a slash, the whole substitution still matches because the slash was optional. In this case all we're matching is the 'end' of the string. The substitution then replaces this (zero-width) match with the new slash, which has the net effect in inserting the trailing slash. for futher reading I’d recommend ‘perldoc perlre’ and the excellent “Mastering Regular Expressions” published by O’Reilly (which is superb)
--- my name's not Keith, and I'm not reasonable. In reply to Re^3: add a character at the end of a string
by reasonablekeith
|
|