domo has asked for the wisdom of the Perl Monks concerning the following question:
You can see what I'm trying to do, can't you? I want to assign an array to a slice of a refernced hash. But I'm damned if I can get the syntax right. I've tried changing quote mthods and diddling with curlies, ->s, $s and and @s until I'm blue in the face, but have had no luck. May I crave the monks' solicitude for my redemption?$ perl -MData::Dumper=Dumper -lwe '$p={}; $p->{qw(fee fie foe)} = (1.. +3); print Dumper $p' $VAR1 = { 'feefiefoe' => '' }; $ perl -MData::Dumper=Dumper -lwe '$p={}; @p->{qw(fee fie foe)} = ( 1..3); print Dumper $p' Can't coerce array into hash at -e line 1.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Syntax for slice of a referenced hash
by arturo (Vicar) on Apr 03, 2001 at 00:14 UTC | |
|
(tye)Re: Syntax for slice of a referenced hash
by tye (Sage) on Apr 03, 2001 at 02:04 UTC | |
|
Re: Syntax for slice of a referenced hash
by bbfu (Curate) on Apr 03, 2001 at 00:15 UTC | |
|
Re: Syntax for slice of a referenced hash
by suaveant (Parson) on Apr 03, 2001 at 00:17 UTC | |
|
Re: Syntax for slice of a referenced hash
by domo (Initiate) on Apr 04, 2001 at 10:36 UTC |