On Sat, Mar 9, 2013 at 2:57 PM, Brandon McCaig <bamcc...@gmail.com> wrote:

> On Sat, Mar 09, 2013 at 07:24:37AM -0600, Chris Stinemetz wrote:
> > Each anonymous array @files and @newFiles has 5 total elements.
>
> Just to nitpick, @files and @newFiles are not anonymous arrays.
> They are just arrays. They have names. You cannot have anonymous
> arrays in Perl except by reference. That is, [] gives you a
> reference to an anonymous array.
>
>   my @named_array = (1,2,3);
>   my $anon_array_ref = [1,2,3];
>   my @named_array_copy_of_anon_array = @$anon_array_ref;
>
> Regards,
>
>
>
I don't think that is true.

Example being:

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

use Data::Dumper;

my $firstVar = "One";
my $secondVar = "Two";

my @array;
push @array,[$firstVar, $secondVar];

print Dumper \@array;

for my $item ( @array ) {
  print join("\t", @$item[0], @$item[1]), "\n";
}


## output ##

$VAR1 = [
          [
            'One',
            'Two'
          ]
        ];
One Two


-Chris

Reply via email to