Leser: 17
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!/usr/bin/perl use strict; use warnings; my %azul = ( FOO => "azul foos secret", FII => "azul fiis secret", FAA => "azul faas secret" ); my %verde = ( FOO => "verde foos secret", BOO => "verde boos secret" ); my @monstros = ( %verde, %azul ); print "monstros[0]{FOO}:\n\'" . $monstros[0]{FOO} . "\'\n\n";
QuoteCan't use string ("FOO") as a HASH ref while "strict refs" in use at ./arrayofhashes.pl line 14.
no strict "refs"
my @monstros = ( %verde, %azul );
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!/usr/bin/perl use strict; use warnings; my %azul = ( FOO => "azul foos secret", FII => "azul fiis secret", FAA => "azul faas secret" ); my %verde = ( FOO => "verde foos secret", BOO => "verde boos secret" ); my @monstros = ( \%verde, \%azul ); print "monstros[0]{FOO}:\n\'" . $monstros[0]->{FOO} . "\'\n\n";