in reply to Understanding this line of Code
$Aoh{ testa } = @{ exec_select ($sql ) } [0] ->{ home1 };
This piece of code basically does the following
- Execute exec_select with $sql as its argument (exec_select($sql))
- Dereference its return value as an array ( @{ ... } )
- Get the first element of this array ( @{ ... } [0] )
- Dereference the array element as a hash ( ->{ ... } )
- Get the key 'home1' from the dereferenced hash ( ->{ home1 } )
- Assign the value stored in the hash with the key 'home1' to $Aoh{testa}
"Can't use an undefined value as a HASH reference..."
This error is caused by the first element in the above array being undefined. Therefor it can't be dereferenced as a hash.
Cheers, Flo
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Understanding this line of Code
by davorg (Chancellor) on Jul 18, 2006 at 13:17 UTC | |
by rafl (Friar) on Jul 18, 2006 at 13:40 UTC |
In Section
Seekers of Perl Wisdom