The code (problematic lines 14 & 15 are put between #====s):
yields the following output:@gum = qw(foo noo goo); @do = qw(test); package test; sub new {my $pkg = shift; bless { name=> "test", array=>\@gum } } sub express{ my ($self, $body) = @_; #======================== print "$body: $self->{name} ", ref $self->{array}," $self->{array}\n" +; print "@$self->{array}\n"; #========================= } package main; foreach $type (@do){ $moo = new $type(); $moo->express("here it is"); }
But the output of line 14 implies that it is an array reference. What's going on?C:\apache\cgi-bin\test>perl phah.pl here it is: test ARRAY ARRAY(0x1824778) Not an ARRAY reference at phah.pl line 15.
BTW, I'm using Hall and Schwartz's "Effective Perl Programming" as reference and guidelines. Can/Should I blame my operating system? (Windows XP; always a fun target for blame casting...)
In reply to references to arrays. I don't really get it I guess... by woozy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |