dwcronin
asked on
hopefully a simple hash error
i'm new to perl so this is hopefully simple. i keep getting the following error:
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- --
syntax error at /home/dwcronin/programs/ex 4_1 line 7, near "$family_name{"
Execution of /home/dwcronin/programs/ex 4_1 aborted due to compilation errors.
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----
specifically. i'm trying to learn hashes by following the o'reilly book 'learning perl" by randal schwartz.
--------------------------
syntax error at /home/dwcronin/programs/ex
Execution of /home/dwcronin/programs/ex
--------------------------
specifically. i'm trying to learn hashes by following the o'reilly book 'learning perl" by randal schwartz.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Alternatively, you can initialize the variable inline:
use warnings;
use strict;
use 5.010;
my %family_name = ("fred", "flintstone");
ASKER
#!/usr/bin/perl; # ex5_1
##########################
use warnings;
use strict;
use 5.010;
my $family_name{"fred"} = "flintstone";
~
~
~
~
~
~