Ok, so I got an array of an array (AoA) and I need to pass it to a subroutine, and then access it. This works… but is it strictly correct and indeed is there a better way that I should be doing this?
#!/usr/bin/perl
$a = "deep";
push(@b,$a);
push(@c,\@b);
print "c = @{$c[0]}\n";
&test(\@c);
sub test
{
$d = $_[0];
print "sub c = @{$$d[0]}\n";
}
Thanks
The definitely better way to do it is to
use strict;anduse warnings;and to declare your variables before using them.Also, you know that is not good practice to name your vars
aorb- give them meaningful names, especially because the$avariable for example, is defined by the compiler (the one used withsort {} @).