On 11-02-09 08:57 PM, Jim Green wrote:
Hello:
I have some static data I want to wrap in a Data.pm, what is the best
way of doing this.
package data;
package Data; # unless it's a pragmatic, it's capitalized
use strict;
use warnings;
my $data=1;
This is lexically scoped to the file. Use one of:
$::data = 1; # no my in front
or
use base qw( Exporter );
our @EXPORT = qw( $data );
1;
I tried
use data;
print $data; but it doesn't work, also I tried print data::$data and
still doesn't work.
Try: $Data::data instead.
--
Just my 0.00000002 million dollars worth,
Shawn
Confusion is the first step of understanding.
Programming is as much about organization and communication
as it is about coding.
The secret to great software: Fail early & often.
Eliminate software piracy: use only FLOSS.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/