E
evillen
Hi
I am trying to pass an array reference to a subroutine but get the
error:
"Not an ARRAY reference at array_ref_test.txt line 14."
I have slimmed down my code so don't worry about why I'm using an array
reference. The reference is getting correctly interpolated at some
point as line 12 reports:
"$key is: CONN_UMP_3MM_SMT"
Thanks for any ideas!
Len
## Please remove line numbers!
###########
1 #! perl -w
2 use strict;
4 my (%symbols_and_data, $key);
5 my @symbol_data = ("CONN_UMP_3MM_SMT", "sym.req:0554",
"lib.name:conn_ump_3mm_smt", "height:3.00mm", "used:01ATiss1/Whitney
RF", "rev:2,NJH,26/05/04");
7 &hash_sym(@symbol_data, $key);
9 sub hash_sym{
10 $symbols_and_data{$_[0]} = \@_[0]; #create new Hash key "reference"
11 foreach $key (keys %symbols_and_data){
12 print "\$key is: $key\n"
13 };
14 print "Elements in this hash key are: ".join(', ',
@{$symbols_and_data{$_[0]}})."\n";
15 }
I am trying to pass an array reference to a subroutine but get the
error:
"Not an ARRAY reference at array_ref_test.txt line 14."
I have slimmed down my code so don't worry about why I'm using an array
reference. The reference is getting correctly interpolated at some
point as line 12 reports:
"$key is: CONN_UMP_3MM_SMT"
Thanks for any ideas!
Len
## Please remove line numbers!
###########
1 #! perl -w
2 use strict;
4 my (%symbols_and_data, $key);
5 my @symbol_data = ("CONN_UMP_3MM_SMT", "sym.req:0554",
"lib.name:conn_ump_3mm_smt", "height:3.00mm", "used:01ATiss1/Whitney
RF", "rev:2,NJH,26/05/04");
7 &hash_sym(@symbol_data, $key);
9 sub hash_sym{
10 $symbols_and_data{$_[0]} = \@_[0]; #create new Hash key "reference"
11 foreach $key (keys %symbols_and_data){
12 print "\$key is: $key\n"
13 };
14 print "Elements in this hash key are: ".join(', ',
@{$symbols_and_data{$_[0]}})."\n";
15 }