That can be fixed as follows by reordering the statememnts, or by wrapping the my (and therefore the sub) in a BEGIN block:
BEGIN { my $foo = "bar\n"; sub print_foo { print $foo; } }
In reply to Re^2: Use of uninitialized value
by ikegami
in thread Use of uninitialized value
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |