Friday, April 13, 2012

Perl - Ref -> Array of Array

#!/usr/bin/perl
use strict;
use warnings;

my @web = ('Command Line','Blog');
my @www = ('http://andre-als.blogspot.com.br/2011/10/perl-table-reference-o.html','=)');
my @data = (\@web,\@www);

foreach my $array (@data){

    #print join ("|", @{$array});

    for(my $i = 0; $i <= $#{$array}; $i++ ){
        print "@{$array}[$i]\n";
    }
}


Result:

$ ./tmp.pl
Command Line
Blog
http://andre-als.blogspot.com.br/2011/10/perl-table-reference-o.html
=)