I have a sub expand() to expand the path
Could some one give me a hint why? I am newbie for Perl.
Thanks!
Code:
sub expand($%) {
my $self = shift;
my ($string, %params) = @_;
# Perform parameter checks.
die("Mandatory parameter 'string' not defined.") unless (defined $string);
//other handling
}
The followng call fails
sub foo {
my $files = {
'test.in' => 'test.out'
};
expand($_)
foreach ( keys( %{$files} ) );
}
saying the 'string' not defined.
While the following codes work:
sub foo {
my $files = {
'test.in' => 'test.out'
};
foreach my $key ( keys %{$files} ) {
expand (+$key); #expand ($key) also fails
}
}
Thanks!
Comment