![]() |
|
Don't ask to ask, just ask | |
PerlMonks |
Re: how to self define a operatorby rjt (Curate) |
on Oct 22, 2019 at 06:19 UTC ( #11107823=note: print w/replies, xml ) | Need Help?? |
What you want to do would require modifying the language with new syntax. Hopefully needless to say, such endeavors are difficult, dangerous, and likely to be a waste of time, even if you are already a language specialist. To wit, the ~~ (smartmatch) binary operator was added to a public release almost 12 years ago, and it's still not stable. You might be able to hack something together with source filters that sort of works in limited cases, but please don't. Odds of something like that breaking in simultaneously spectacular and sneaky fashion are unacceptably high for anything other than toy programs. Would you mind sharing more details on what you are actually trying to accomplish (apart from inventing syntax)? A proper description of what you are actually working on would help us help you. There may well be an easy, elegant solution in pure Perl.
In Section
Seekers of Perl Wisdom
|
|