#!usr/bin/perl
@array = ();
open(myfile,"sometext.txt");
while(<myfile>)
{
chomp;
push(@array,[split(" ")]);
}
close(myfile);
print @array[0];
Instead of printing the elements of the first array in this multidimensional array, it outputs the hexadecimal(?) pointer reference. If anyone knows how I can print this array, please post how and it will be greatly appreciated.
Here you go.
Perl’s multi-dimensional arrays are really arrays of references to the arrays. In perl a reference is just a scalar variable. So, when you are trying to print your whole array it prints out just that reference. You need to use the @{} to change the context of the scalar to array.