in reply to Re: Re: aliasing subs
in thread aliasing subs
sub match { my $context = (caller(1))[3]; my $arg = shift; my @result = $arg =~ /$pattern/; # $context =~ /dirname/ ? $result[0] : $context =~ /basename/ ? $result[1] : ... # etc. # otherwise, return the whole result vector: @result } sub dirname { &match } sub basename { &match } # etc.
jdporter
The 6th Rule of Perl Club is -- There is no Rule #6.
|
---|