> -----Original Message-----
> From: Bob Showalter [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 17, 2003 1:00 PM
> To: 'LoBue, Mark'; [EMAIL PROTECTED]
> Subject: RE: Assigning an array to a hash
> 
> 
> LoBue, Mark wrote:
> > Hello,
> > 
> > Using Perl 5.001 (can't upgrade it, don't ask), I have tried to
> > assign an array to the following hash reference 2 ways, but I can't
> > seem to get it: 
> > 
> > 
> @[EMAIL PROTECTED]; gives an
> > error: Can't use subscript on associative array slice at ./pump.pl
> > line 60, near "$pumpName}"
> > 
> > and:
> > 
> > 
> @($pumpData{$p_ptId}{$pumpName}{$primary}{solution})[EMAIL PROTECTED]; gives
> > an error: Scalar found where operator expected at ./pump.pl line 64,
> >         near "@($pumpData" (Missing operator before $pumpData?)
> 
> Use either:
> 
>   @{$pumpData{$p_ptId}{$pumpName}{$primary}{solution}} = @solution;

This worked great, thanks.  Why did I think braces were for hashes and
parens were for arrays?  I need to go read some more.

> 
> or
> 
>   $pumpData{$p_ptId}{$pumpName}{$primary}{solution} = [ @solution ];
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to