Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Perl Script Below:# result from running learn_module.pl VAL1: Learning=HASH(0x194ee0) VAL2: foo VAL1: Learning=HASH(0x194ee0) VAL2: bar
Perl Module Below:use strict; use warnings; use Learning; my $new_module = Learning->new; my %hash = (); push @{$hash{vals}}, "foo"; push @{$hash{vals}}, "bar"; my $text2 = "This is a string"; foreach my $data1 ( @{$hash{'vals'}} ) { my ($val1, $val2) = $new_module->return_two_values($data1, $text2) +; print "VAL1: $val1\n"; print "VAL2: $val2\n\n"; }
Any help would be greatly appreciatedpackage Learning; use strict; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); require Exporter; require AutoLoader; @ISA = qw(Exporter AutoLoader); @EXPORT = qw(); $VERSION = '0.01'; sub new { my $self=shift; my $class=ref($self) || $self; return bless {}, $class; } sub return_two_values { my ($val1, $val2) = @_; return ($val1, $val2); } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Issue with creating module
by samtregar (Abbot) on Mar 12, 2008 at 19:23 UTC | |
by Anonymous Monk on Mar 12, 2008 at 19:29 UTC |