my $scan = 'foo'; # here $scan == 'foo'; if ( $something ) { my $scan = 'bar'; # here $scan == 'bar'; } # now the $scan we defined in the if() {} is out of scope, # gone, defunct, forgotten, inaccessible so $scan == 'foo'