From:   Steve Bertrand <st...@ibctech.ca>
> Jenda Krynicky wrote:
> > From: Steve Bertrand <st...@ibctech.ca>
> >> my $user = EagleUser->new();
> >>
> >> $user->build_inf_user('steveb');
> >>
> >> print "$user->{'login_name'}\n"; # outputs 'steveb' as expected
> >>
> >> while ( my ($key, $value) = each($user) ) {
> > 
> >  while ( my ($key, $value) = each(%$user) ) {
> > 
> >>         print "$key => $value\n";
> >> }
> >>
> >> ---- end code ----
> >>
> >> Cheers,
> >>
> >> Steve
> > 
> > It doesn't matter whether it's an object. It's a hash reference so 
> > you can treat it as such. And since each() expects a hash, not a hash 
> > reference, you have to dereference. That is put a % in front of the 
> > $user.
> 
> Thanks Jenda.
> 
> I'm going to have to really focus on learning about the dereferencing
> factor, and where/when some of the [${}->] etc need to be, because I
> don't have a very good grasp on that.

Try the perlreftut man page.
(http://perldoc.perl.org/perlreftut.html)

Jenda
===== je...@krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to