[JaxPM] Re: Coding without a net

Brett Rabideau misha at toto.com
Thu Jun 15 05:09:41 CDT 2000


On the jacksonville-pm-list; Jax.PM'er Brett Rabideau <misha at toto.com> wrote -

You're very close - but you have the incorrect syntax.  It should be:

$hash = ( 'key1' => ['v1a', 'v2a'],
          'key2' => ['v2a', 'v2b']);

You should use square brackets on the array.

Kind Regards,

Brett Rabideau
 "She sells C-Shells and other Assorted Perls by the Seashore..."
 Periwinkle Communications LLC
 Performance-based Web Site Hosting, Programming & Design
 http://www.toto.com
 misha at toto.com

--On Wednesday, June 14, 2000 9:50 PM -0400 j proctor 
<jproctor at oit.umass.edu> wrote:

>
> Well, really, without a Camel or a Panther.  Or even a Llama.
>
> I'm missing something here.  I'm sure it'll be obvious when one of you
> points out what I'm doing wrong.
>
> I'm trying to assign an anonymous array as the value in a hash.
>
> %hash = ( 'key1' => ('v1a', 'v1b'),
>           'key2' => ('v2a', 'v2b')  );
>
> # therefore $hash{'key1'}[0] will equal 'v1a', etc.
>
> So what I'm missing is the way to tell Perl that the inner ()s should be
> treated as an anonymous hash.  I just can't think of the syntax to do
> that.  Arrrrgh.
>
>
> j
>



Jax.PM Moderator's Note:
This message was posted to the Jacksonville Perl Monger's Group listserv.
The group manager can be reached at -- owner-jacksonville-pm-list at pm.org
to whom send all praises, complaints, or comments...




More information about the Jacksonville-pm mailing list