[vienna.pm] use strict & indirekter subroutinen-aufruf
Baier Oliver INT SD
BaierO at spardat.at
Thu Apr 4 06:07:57 CST 2002
* * * vienna-pm-list * * *
Hi!
Weiss einfach nicht, wie ich die subroutine deklarieren muss,
um sie nachher ueber "&{$stats{$ARGV[0]}}($param)" indirekt
aufzurufen zu koennen. "sub test;" funkt nicht.
Kann mir jemand einen Tip geben?
lg
Oliver
-----------------------------------------------------------------
my %stats = (
4 => "test"
);
if (defined $ARGV[0] && exists $stats{$ARGV[0]}) {
my $ssh = Net::SSH::Perl->new($host, port => 22);
$ssh->login($user, $pass);
&{$stats{$ARGV[0]}}($param);
} else {
die "Which values do you want?\n";
}
sub test{
print "$_[0] erfolgreich uebergeben.\n";
}
---
13:38:55 ~ $ bla.pl 4
Can't use string ("test") as a subroutine ref while "strict refs" in use at ./bla.pl line 31, <GEN0> line 1.
-----------------------------------------------------------------
###
You are subscribed to vienna-pm-list as "Baier Oliver INT SD" <BaierO at spardat.at>
http://www.fff.at/fff/vienna.pm/
More information about the Vienna-pm
mailing list