[Israel.pm] A Perl 5 Gotcha

Yitzchak Scott-Thoennes sthoenna at efn.org
Thu Mar 5 23:35:03 PST 2009


On Thu, March 5, 2009 1:12 pm, Shlomi Fish wrote:
> my $filename = "hello.txt";
>
> sub print_filename {
>     print $filename, "\n";
> }

One thing you can do is to do the initialization at compile time:

    my $filename;
    BEGIN { $filename = "hello.txt" }





More information about the Perl mailing list