>>128
それはスコープの外に print $fooがあるので動作しない

if ($hoge eq 'hoge') {
 my $foo = 'hoge!';
 print $foo;
}
コレが正解