I am not sure what's going on here. But do you have
use strict; use warnings; at the top of your script?
if (-e $filepath)
{
my $exception...
}
else
{
my $exception...
}
shouldn't compile. In general a "my" variable cannot be declared within a conditional statement.
EDIT: yes this will compile, but
$exception cannot be used outside of its lexical scope.
$exception is reference to a hash:
#!/usr/bin/perl
use strict;
use warnings;
my $exception = {table => 'tablename',
exception => 'outofdate'};
my $exception2 = {table => 'tablename2',
exception => 'allOk'};
foreach my $error ($exception, $exception2 )
{
print "$error->{exception}\n";
}
__END__
outofdate
allOk