It's a hash *reference*, so you'd need to use:
print $$row{$field}

> -----Original Message-----
> From: Gohaku [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 23, 2003 12:29 PM
> To: [EMAIL PROTECTED]
> Subject: fetchrow_hashref Question
> 
> 
> Hi everyone,
> I just found out about fetchrow_hashref after using fetchrow_array for 
> quite a while now.  I have some questions about the following code:
> while ( my $row = $sth->fetchrow_hashref ) {
>      print "New User:\n";
>      foreach my $field ( sort keys %{ $row } ) {
>          print "$field: $row->{ $field }\n";
>      }
>   }
> 
> If I try to print $row{$field}, I  don't see anything, why is that?
> Thanks in advance.
> 
> -gohaku

Reply via email to