>>>>> "LS" == Lawrence Statton <lawre...@cluon.com> writes:
LS> On 04/12/2011 08:26 AM, marcos rebelo wrote: >> Hi all >> >> I have a code like: >> >> foreach my $key ( ... ) { >> my $sub = "get_$key"; >> $self->$sub; >> ... >> } >> >> If I can do this, I can also do it without the variable $sub. >> >> What is the syntax? please >> >> Best Regards >> Marcos Rebelo >> LS> #!/usr/bin/perl LS> use strict; LS> use warnings; LS> no strict 'refs'; # to allow you to use names as references that is wrong and very very bad. strict is there for a reason. never do this. a dispatch table is the correct version of this. also it doesn't address the actual question of methods by name - these are plain subs. uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/