in reply to hash deref confusion: Intermediate Perl
Are they actually saying that you can have a list of keys ("qw(wins places shows losses)") and set the values by setting this to the list "@standings"?? Really?
Why not just try it and see?? A toy experimental program takes less than a minute to create and run. Really!
>perl -wMstrict -le "use Data::Dump; ;; my $self = { foo => 'bar' }; my @standings = qw(1 2 3 4); ;; @$self{ qw(wins places shows losses) } = @standings; ;; dd $self; " { foo => "bar", losses => 4, places => 2, shows => 3, wins => 1 }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: hash deref confusion: Intermediate Perl
by live4tech (Sexton) on Jul 30, 2012 at 14:03 UTC |
In Section
Seekers of Perl Wisdom