I am trying to check if a directory exists in a UNIX system with Perl.
while (my @row = $sth->fetchrow_array) {
my $id = $row[0];
my $hash = $row[1];
my $direction = '/home/users/' . $hash
if(-d $direction){
print "$direction exists";
}
}
But I get this error:
Global symbol "$direction" requires explicit package name at Perl.pl line 31. syntax error at Perl.pl line 31, near "){" syntax error at Perl.pl line 35, near "}" Execution of Perl.pl aborted due to compilation errors.
Line 31 in this case is:
if(-d $direction)
Any ideas?
strict! :)