Do it this way

my @arr = ([10,20], [100,200], [111,222]);

foreach my $a (@arr)
{
   print "a=$a->[0], b=$a->[1]\n";
}

in perl ((1,2), (3,4)) is actually (1,2,3,4)

see http://perldoc.perl.org/perllol.html


On Wed, May 1, 2013 at 11:06 AM, Chanan Berler <[email protected]> wrote:

> Hi All,
>
> Quick Perl question: Why I can not do something like this?
>
> my @arr = ((10,20), (100,200), (111,222));
>
> foreach my ($a,$b) (@arr)
> {
>    print "a=$a, b=$b\n";
> }
>
>
> Regards
> Chanan
>
> --
> ===================
> ----     Chanan Berler    ----
> ===================
>
> _______________________________________________
> Perl mailing list
> [email protected]
> http://mail.perl.org.il/mailman/listinfo/perl
>
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to