in reply to Re: calling functions using array variables
in thread calling methods using array variables

Oh. Ok, so your problem is in calling a method.

Then the solution is get the name of the method into a scalar variable before trying to call it.

#!/usr/bin/perl use strict; use warnings; package Foo; sub new { bless {}, shift; } sub test { print "pass\n"; } package main; my @subs = ('test'); my $foo = Foo->new; my $method = $subs[0]; $foo->$method;
--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Replies are listed 'Best First'.
Re^3: calling functions using array variables
by friedo (Prior) on Nov 28, 2005 at 14:34 UTC
    my $method = $subs[0]; $foo->$method;

    Or, if you're in the mood for obfuscation:

    $foo->${ \$subs[0] };
Re^3: calling functions using array variables
by rsennat (Beadle) on Nov 28, 2005 at 10:50 UTC
    Thats really gr8 stuff!!!!!!!!!!!!!!

    For calling methods from array variables. cool.

    Thanks a lot.

    rsennat