Re: Forcing array context

2005-08-20 Thread Peter Rabbitson
> perldoc -q "What is the difference between a list and an array" As a side note to the POD above - although lists can not change sizes they are addressable just like arrays. In other words the following two statements are equivalent: my @slice = @{ [ (split /\|/, 'a|b|c|d|e') ] }[1,3]; my @s

Re: Forcing array context

2005-08-20 Thread John W. Krahn
Binish A R wrote: > How can I force array context ... Sorry, you can't. You can have either list context or scalar context or void context. perldoc -f wantarray > like > > # echo hello: world | perl -lne '$aref = split(/:/, $_); print $aref' > > but thatz giving the length of the array Tha

RE : Forcing array context

2005-08-20 Thread Jose Nyimi
Try this: echo hello: world | perl -lne '$aref = [ split(/:/, $_) ]; print $aref' [] synthax gives a ref to the array returned by split() HTH, José. -Message d'origine- De : Binish A R [mailto:[EMAIL PROTECTED] Envoyé : samedi 20 août 2005 17:15 À : Perl Beginners Objet : Forcing array

Re: Forcing array context

2005-08-20 Thread Peter Rabbitson
On Sat, Aug 20, 2005 at 08:44:34PM +0530, Binish A R wrote: > How can I force array context ... > like > > # echo hello: world | perl -lne '$aref = split(/:/, $_); print $aref' > > but thatz giving the length of the array ... I want $aref to be a reference > ... > How is that possible ?? Very