open(SRC, $0) or die("ack: $!"); my @lines = ; ## $line is declared *before* the braces foreach my $line (@lines) { ## $w is declared within the condition, which is ## also before the braces if(my($w) = $line =~ /\b(\w+)\b/) { print "bareword found: $w\n"; } print "\$w is: ", (defined $w ? $w : "undefined"), $/ if $line eq $lines[$#lines]; } print "\$line is: ", (defined $line ? $line : "undefined"), $/; __output__ bareword found: open bareword found: my bareword found: foreach bareword found: if bareword found: print bareword found: print bareword found: if bareword found: print $w is: undefined $line is: undefined