Reputation: 169
I know I am missing something simple here, but I can't figure it out and google is not working
I am trying to use the value for $F
but it is not working. I will leave out some of the code. I get an error basically saying that $f
requires a specific package name
sub captureFile()
{
my $F = $File::Find::name;
if ($F = ~/txt$/)
{
$F=~ s:(.*)(\/reports\/.*):$2:;
loadEnvironmentProperties($F);
}
}
sub loadEnvironmentProperties()
{
print $F;
}
Upvotes: 0
Views: 47
Reputation: 385789
Always use strict; use warnings;
!
You try to specify $F as an argument
loadEnvironmentProperties($F);
^^
to a function you declared has no parameters
sub loadEnvironmentProperties()
^^
and you never actually read the arguments in loadEnvironmentProperties
. You want:
sub loadEnvironmentProperties {
my ($F) = @_;
print $F;
}
Upvotes: 8
Reputation: 1921
$F does not exist the second subroutine because you did not get it out the parameters array
sub loadEnvironmentProperties()
{
my $F = shift;
print $F;
}
Upvotes: 2