It sounds as if you aren't passing a reference to %ARGS to the subroutine but instead %ARGS itself. Observe:
#!/usr/bin/perl -wl use strict; my %hash = (something => 1,precinct => 2); sub test { my $new = shift; print $new->{'precinct'}; } eval { print "as ref:"; test(\%hash); }; print $@ ? "Died: $@$/":"No error$/"; eval { print "as hash:"; test(%hash); }; print $@ ? "Died: $@$/":"No error$/"; __END__ as ref: 2 No error as hash: Died: Can't use string ("precinct") as a HASH ref while "strict refs" +in use at test.pl line 8.
Of course, I may be wrong. In either case, I hope this helps.
antirice
The first rule of Perl club is - use Perl
The ith rule of Perl club is - follow rule i - 1 for i > 1
In reply to Re: Ah, the old "Can't use string ("string") as a HASH ref"
by antirice
in thread Ah, the old "Can't use string ("string") as a HASH ref"
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |