in reply to What is it I don't understand about perl scoping?

As you say the use warnings flag would have told you you were calling my on a variable already declared in the same scope. compare your code with that below
#!/usr/local/bin/perl use strict; my $foo = 1; my $fum = 1; print STDERR "variables are now: $foo,$fum\n"; &foo(); { my $foo = 2; $fum = 2; print STDERR "variables are now: $foo,$fum\n"; } sub foo { print STDERR "variables are now: $foo,$fum\n"; } variables are now: 1,1 variables are now: 1,1 variables are now: 2,2
By enclosing the redeclaration in a block you avoid scope confusion