子程序我有一個代碼,是這樣的一個數組裏面這就是:的Perl:如何訪問3個哈希通過參照
foreach $item (@total_data)
{
setinfo($item);
} # @total_data contains an array of references to hashes (\%hash1 ... \%hashN)
在subrutine是這樣的:
sub setinfo
{
my ($argument) = @_;
my $i = 0;
#inside original hash $argument{"data"}{"fulldraw"} there is an [array]
#that contains numbers of the form XYYZ and I want to split them into
#the following pairs XY YY YZ but that code works ok#
foreach $item (${$argument{"data"}{"fulldraw"}})
{
my $match;
my $matchedstr;
if ($item =~ /^\d{4}$/)
{
...
}
else
{
print STDERR "DISCARDED: $item\n";
}
}
}
我知道我可能在解除它的引用方面犯了錯誤,但無法弄清楚我在互聯網上閱讀過的所有文章。
謝謝!
http://perlmonks.org/?node=References+quick+reference – ysth