|
|
| "be consistent" | |
| PerlMonks |
Re: How do I call a sub using a variable as its name, objectivelyby choroba (Cardinal) |
| on Oct 28, 2024 at 19:20 UTC ( [id://11162456]=note: print w/replies, xml ) | Need Help?? |
|
It's in fact much easier. Use a variable to keep the method name:
Using it:
Otherwise, you need to do a reference/dereference trick:
Update: Fixed arguments for the second example. Thaks etj.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||