Global symbol "$variable" requires explicit package name at filename.pl

Viewed 3184

From my understand of perl, i think that error message means i have an undeclared variable called $something for example ? I have a foreach statement as such :

foreach my $as (@ARRAYY) {
            $db-> execute($as->[1],$as->[0],$Key);
        } 

I get an error on $as saying :

Global symbol "$as" requires explicit package name at filename.pl

My confusion is, hasn't $as been already declared in the foreach statement ? as :

my $as ? before the foreach keyword ?

Thank you for reading. Your thoughts are highly appreciated !

Update

foreach my $as (@ASPATH) {
            #print "\tASPATH : $as->[0]","\t" ;
            #print "\tASINDEX : $as->[1] \n" ;
            $as_path->execute($as->[1],$as->[0],$UpdateKey);
        } 
1 Answers
Related