awohld has asked for the wisdom of the Perl Monks concerning the following question:
I'd expect it to be as below:#!/usr/bin/perl -w use strict; use Data::Dumper; my %hash; my @keys = qw ( one two three ); my @values = qw ( 1 2 3 ); # What's with the @ symbol and not a $? @hash{@keys} = @values; print Dumper \%hash;
Why do you need the '@' preceding the hash name and not a '$'?#!/usr/bin/perl -w use strict; use Data::Dumper; my %hash; my @keys = qw ( one two three ); my @values = qw ( 1 2 3 ); # I thought it would need a $! $hash{@keys} = @values; print Dumper \%hash;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: meaning of '@' sigil on a hash?
by ikegami (Patriarch) on Dec 08, 2007 at 19:19 UTC | |
Re: meaning of '@' sigil on a hash?
by shmem (Chancellor) on Dec 08, 2007 at 18:18 UTC | |
Re: meaning of '@' sigil on a hash?
by Burak (Chaplain) on Dec 08, 2007 at 18:28 UTC | |
Re: meaning of '@' sigil on a hash?
by plobsing (Friar) on Dec 08, 2007 at 17:57 UTC | |
Re: meaning of '@' sigil on a hash?
by bradcathey (Prior) on Dec 09, 2007 at 00:17 UTC |