-----Original Message-----
>From: Chas Owens <[EMAIL PROTECTED]>
>Sent: Aug 3, 2007 3:21 AM
>To: Jeff Pang <[EMAIL PROTECTED]>
>Cc: beginners@perl.org
>Subject: Re: Problem with my code
>
>On 8/3/07, Jeff Pang <[EMAIL PROTECTED]> wrote:
>>
>>
>> -----Original Message-----
>> >From: Mihir Kamdar <[EMAIL PROTECTED]>
>>
>> >$hash{$cdr[2],$cdr[3],$cdr[6],$cdr[7]}=$line;  #Add some more cdr key 
>> >fields if u want.
>>
>> There are (maybe) two problems above.
>> 1. when using hash slice,the form is @hash{'key1','key2'...},not 
>> $hash{'key1','key2'...}
>> 2. when you say @hash{$cdr[2],$cdr[3],$cdr[6],$cdr[7]}=$line,only the first 
>> key ($cdr[2])
>>  has got value,the other keys would get undef as their values,since $line is 
>> a scalar,
>> but the statement expect a list on the right of '=' I think.
>
>I don't think he is trying to use the slice notation.  He is using the
>multidimensional array emulation.  This not really a good practice
>because it is easy to confuse it with slices.   A better way to get
>the same functionality is
>
>$hash{"@cdr[2,3,6,7]"} = $line;
>
>The quotes act as a signal that you aren't looking for a slice.
>

Yes I know this expression too.But why one should write something like 
this?It's too out of date.

--
Jeff Pang <[EMAIL PROTECTED]>
http://home.arcor.de/jeffpang/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to