perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ed Grimm <edgr...@dsblade00.wat.us.ray.com>
Subject Re: proper referencing of hashes returned by fetchrow_hashref . . .
Date Wed, 25 Jun 2003 02:39:02 GMT
It's a perl language thing.  fetchrow_hashref returns a hashref, not a
hash.  You can also use the following two syntaxes, which may make more
sense to you:

The same thing, more explicitly:
> 	fieldname: [+ ${$hashed_row}{'fieldname'} +]<br>

Syntactic sugar, everyones favorite treat:
> 	fieldname: [+ $hashed_row->{'fieldname'} +]<br>

Ed

On Tue, 24 Jun 2003, Richard Schilling wrote:

> Just a quick question, and perhaps it's a Perl language question.  I
> forget, but why do you have to reference a hash with a double "$$" when
> you use fetchrow_hashref?
>
> 	[-
> 	use DBI;
>
> 	# code to open connection, run query, etc . . .
> 	-]
>
> 	[$ if $hashed_row = $query->fetchrow_hashref $]
> 	fieldname: [+ $$hashed_row{'fieldname'} +]<br>
> 	[$ endif $]
>
> Don't know why but for some reason I'm drawing a blank . . .
>
> Thanks.
>
> --Richard
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message