|There's more than one way to do things|
Smart match in p5by xmath (Hermit)
|on Mar 13, 2005 at 12:18 UTC||Need Help??|
In response to Juerd's request for a smart match operator in perl 5, I've implemented a patch which adds it to the parser.
http://cds.xs4all.nl/smartmatch/ -- See the README for installation instructions.
The actual smart matching is expected to be implemented by a perl module SmartMatch.pm, an outline of which can be found in the above directory.
Note that prefix '~~' still works like it did previously. Therefore if foo is a sub, then foo~~bar will be parsed as foo(~~bar) unless foo has prototype ().
So.. any other syntax that would be nice to hack into perl? :-)
Update (14:39 CET) -- Revised version, see README for changes.
Update (00:12 CET) -- Added negated smart match (!~~)