Note that 'symbolic names' work perfectly fine as 'method names' under strict and warnings :)
#!/usr/bin/perl # https://perlmonks.org/?node_id=1232013 use strict; use warnings; my $someCondition = 0; my $arg1 = 'arg1'; my $arg2 = 'arg2'; my $funcname = ( $someCondition ? 'foo' : 'bar' ); SomeClass->$funcname($arg1, $arg2); package SomeClass; sub foo { print "in 'foo' with args: @_\n" } sub bar { print "in 'bar' with args: @_\n" }
In reply to Re: Function name in a variable, can't recall the concept
by tybalt89
in thread Function name in a variable, can't recall the concept
by mpersico
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |