SPUG: each function won't recognize hash deref
Kevin Fink
kevin at n2h2.com
Thu Jun 1 12:50:24 CDT 2000
Shouldn't that be each(%$data)?
Kevin
On 1 Jun 2000 starfire at zipcon.net wrote:
> The retrieve subroutine of Storable.pm returns a hash ref. But when I deref
> the return value and pass it to the each function, perl doesn't recognize it
> as a hash:
>
> $data = retrieve("$sambadir/hitcount.dat");
> while (($key, $value) = each($$data)) {
> ...
>
> Type of arg 1 to each must be hash (not scalar deref) at hitsbyid.cgi line 41,
> near "$data)"
> syntax error at hitsbyid.cgi line 43, near "("
>
> If this were C, I would throw in a typecast. Do I need to bless my hashref
> somehow?
>
> Richard.Anderson
> Richard.Anderson at raycosoft.com
> www.unixscripts.com
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
> Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
> For Subscriptions, Email to majordomo at pm.org: ACTION spug-list EMAIL
> Replace ACTION by subscribe or unsubscribe, EMAIL by your Email address
>
>
------------------------------------------------------------------------------
Kevin Fink <kevin at n2h2.com> N2H2, Creators of Bess and Searchopolis
Chief Technology Officer 900 Fourth Avenue, Suite 3400
http://www.n2h2.com/ Seattle, WA 98164
VOICE: 206-336-1501 / 800-971-2622 FAX: 206-336-1541
------------------------------------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
For Subscriptions, Email to majordomo at pm.org: ACTION spug-list EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email address
More information about the spug-list
mailing list