We don't bite newbies here... much | |
PerlMonks |
Re: List or Scalar?by hagen (Friar) |
on Aug 27, 2003 at 23:28 UTC ( [id://287204]=note: print w/replies, xml ) | Need Help?? |
Many thanks to antirice and NetWallah - their diagnosis is absolutely correct; and I have now a (little) better understanding of Perl's references Using the $term->[0] syntax is the answer and I now assume that the print command was kinda "DWIM"ing the ref for me, but in the for loop it wasn't. A bit subtle for my present level of Perlishness 8-)... but on further reflection this would be because print is in list context - and of course the (-1..@{$term}) is scalar - Insight! antirice... Data::Dumper printed as follows
... are the single quotes trying to tell me something? and NetWallah... Thanks for that very revealing code snippet... I'll keep a copy of that to remind me of the various syntactic options re references. I've just re-read MJD's perlreftut and I think I see where I misunderstood the syntax. cheers and thanks again... what a great resource Perl Monks is..... hagen.
In Section
Seekers of Perl Wisdom
|
|