Thursday, 29 August 2013

BEGIN block and variable declaration

BEGIN block and variable declaration

Is it valid perl to set a variable in a BEGIN block, but declare the
variable outside the BEGIN block?
#!/usr/bin/env perl
use strict;
use warnings;
use 5.10.0;
my $var;
BEGIN{ $var = 10 }
say $var;

No comments:

Post a Comment