# result from running learn_module.pl VAL1: Learning=HASH(0x194ee0) VAL2: foo VAL1: Learning=HASH(0x194ee0) VAL2: bar #### 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"; } #### package 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;