Perl-Sensitive Sunglasses | |
PerlMonks |
Re: Chaining string opsby seattlejohn (Deacon) |
on Aug 28, 2003 at 17:20 UTC ( [id://287458]=note: print w/replies, xml ) | Need Help?? |
Something like this?
Quick inspection tests:
You'd probably want to overload the other stringy functions (comparisons, concat) as well to make the semantics consistent. As written, this won't handle backreferences in the replacement string. There are probably other limitations. I personally don't see a lot of benefits to this substitution chaining idiom in the first place, but I thought it might be fun to show an example of blessing something other than a hashref. $perlmonks{seattlejohn} = 'John Clyman';
In Section
Seekers of Perl Wisdom
|
|