Perl + PerlCritic | loop iterator is not lexical

By Anton Shevtsov

I have this code

...
    my $line = '';
        foreach $line ( split( /n/x, $raw ) ) {
            chomp $line;
            my ( $key, $val ) = split( /=/x, $line );
            $param{$key} = $val;
        }
...

After perlcritic checking, i get messsage “Loop iterator is not lexical.”
Whats wrong?

I can use

 #my $line = '';
            foreach my $line ( split( /n/x, $raw ) )

but why? :)

Source: Stack Overflow

    

Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273