@data=; <-- Puts the whole file in @data while() <-- There's nothing left to read here. #### #!/usr/bin/perl use strict; use warnings; my @list; open(my $fh, '<', $file) or die("Unable to open file \"$file\": $!\n"); while (<$fh>) { push @list, [split/s+/]; }