in reply to Subarray in a hash: Can't use string ("STRING") as a HASH ref while "strict refs" in use
my @array_of_hashes; for (my $i=1; $i<=10; $i++) { $array_of_hashes[$i] = { stuff => 'stuffy', goes => 'gooey', here => "more $i" }; $array_of_hashes[$i]{sub_data}[6] = "seven"; }
Update: In your original code, assignment to a hash value introduced a scalar context. In scalar context, the list in parentheses returned its last member, "more $i". You later tried to use this value as a hash reference.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Subarray in a hash: Can't use string ("STRING") as a HASH ref while "strict refs" in use
by GeoJunkie (Initiate) on Apr 08, 2014 at 13:48 UTC | |
by choroba (Cardinal) on Apr 08, 2014 at 13:51 UTC | |
by shawnhcorey (Friar) on Apr 08, 2014 at 14:22 UTC | |
by andal (Hermit) on Apr 08, 2014 at 13:52 UTC |