in reply to Parsing a hash into a sub
Some observations:
For passing the hash to the sub, you can use a reference. Try this module...
## file: Myperl.pm package Myperl; use strict; require Exporter; our $VERSION = 0.1; our @ISA = qw(Exporter); our @EXPORT = qw(getInfo); our %EXPORT_TAGS = (); our @EXPORT_OK = qw(); sub getInfo { my $thescalar=shift; my $thehash=shift; ## pick a reference print "scalar: $thescalar\nhash:\n"; print "$_ => ", $thehash->{$_}, "\n" for keys %$thehash; } 1;
...with this code:
use Myperl; my $s=4; my %h=(0..5); my $myresult=getInfo($s, \%h); ## pass a reference
--
David Serrano
|
|---|