B
bpatton
I have 3 routines seperated by __END__
The BEGIN makes it work
#!/usr/local/bin/
perl
# this works
fine
use strict;
use warnings;
if ( !defined caller ) { foo::foo(); }
package foo;
use strict;
use warnings;
use Data:umper; $Data:umper::Indent = 1;
use vars qw ( %hash );
BEGIN { %hash = ( a => { b => 1 , c => 2 },); }
sub foo { print Dumper(\%hash); }
__END__
#!/usr/local/bin/
perl
#This produces an empty
hash
use strict;
use warnings;
if ( !defined caller ) { foo::foo(); }
package foo;
use strict;
use warnings;
use Data:umper; $Data:umper::Indent = 1;
use vars qw ( %hash );
%hash = ( a => { b => 1 , c => 2 },);
sub foo { print Dumper(\%hash); }
__END__
#!/usr/local/bin/
perl
#This dumps an empty hash
table
use strict;
use warnings;
if ( !defined caller ) { foo::foo(); }
package foo;
use strict;
use warnings;
use Data:umper; $Data:umper::Indent = 1;
my %hash = ( a => { b => 1 , c => 2 },);
sub foo { print Dumper(\%hash); }
The BEGIN makes it work
#!/usr/local/bin/
perl
# this works
fine
use strict;
use warnings;
if ( !defined caller ) { foo::foo(); }
package foo;
use strict;
use warnings;
use Data:umper; $Data:umper::Indent = 1;
use vars qw ( %hash );
BEGIN { %hash = ( a => { b => 1 , c => 2 },); }
sub foo { print Dumper(\%hash); }
__END__
#!/usr/local/bin/
perl
#This produces an empty
hash
use strict;
use warnings;
if ( !defined caller ) { foo::foo(); }
package foo;
use strict;
use warnings;
use Data:umper; $Data:umper::Indent = 1;
use vars qw ( %hash );
%hash = ( a => { b => 1 , c => 2 },);
sub foo { print Dumper(\%hash); }
__END__
#!/usr/local/bin/
perl
#This dumps an empty hash
table
use strict;
use warnings;
if ( !defined caller ) { foo::foo(); }
package foo;
use strict;
use warnings;
use Data:umper; $Data:umper::Indent = 1;
my %hash = ( a => { b => 1 , c => 2 },);
sub foo { print Dumper(\%hash); }