in reply to Re^2: Compare and copy array values
in thread Compare and copy array values

If you do re-declare them, they will override the earlier one.

my $crap =1; print "crap is $crap\n"; my $crap =2; print "crap is $crap\n";
produces
crap is 1 crap is 2

If you include use warnings; at the beginning of the scripts, you will get "my" variable $crap masks earlier declaration in same scope at crap.pl line 8. which can be very useful!

Just keep in mind that it checks in the same scope. That means you can re-declare the same variable name inside a loop and Perl will silently accept it.

Enjoy
~ Michael