Hi Chanan,

On Wed, 1 May 2013 11:06:24 +0300
Chanan Berler <bc.ot...@gmail.com> wrote:

> Hi All,
> 
> Quick Perl question: Why I can not do something like this?
> 
> my @arr = ((10,20), (100,200), (111,222));

This is a list of lists which will be flattened. See:

http://perl-begin.org/topics/references/

> 
> foreach my ($a,$b) (@arr)
> {
>    print "a=$a, b=$b\n";
> }
> 

You shouldn't lexicalise $a and $b -
see http://perl-begin.org/tutorials/bad-elements/#vars-a-and-b

Regarding your question - such a feature would be nice to have, but will
require some work and Perl 6 has a similar feature.

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Rethinking CPAN - http://shlom.in/rethinking-cpan

An original philosopher knows the right combination of ideas to steal.

Please reply to list if it's a mailing list post - http://shlom.in/reply .
_______________________________________________
Perl mailing list
Perl@perl.org.il
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to