develooper Front page | perl.perl6.language | Postings from July 2001

Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

From:
David L. Nicol
Date:
July 20, 2001 13:09
Subject:
Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])
Message ID:
3B588E11.D5A15694@kasey.umkc.edu
'John Porter ' wrote:
> 
> Sterin, Ilya wrote:
> > Well then maybe $_ can be a reference to a multidimensional array or hash,
> > and temp vars can be access like this.
> >
> > for ( @foo, @bar ) {
> >   print "$_->[0] : $_->[1]\n";
> > }
> 
> That's bizarre and unnecessary.  We can already do this:
> 
>   for ( \@foo, \@bar ) {
>     print "$_->[0] : $_->[1]\n";
>   }
> 
> --
> John Porter


No, that does not work:

perl -le '@solids=(1..7);@stripes=(9..15);\
	for (\@stripes, \@solids){\
	    print "$_->[0] and  $_->[1] are the same color"\
	}'

9 and  10 are the same color
1 and  2 are the same color



-- 
                                           David Nicol 816.235.1187
                       "Mary had a little chainsaw" -- Angus Oblong




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About