#! perl use strict; use warnings; use Data::Dump; my $file = 'x.dat'; my $column = 3; my $separator = qr{\s+}; # split on whitespace my @values; open(my $fh, '<', $file) or die "Cannot open file '$file' for reading: $!"; while (my $line = <$fh>) { chomp $line; # remove the trailing newline my @cols = split $separator, $line; push @values, $cols[$column]; } close $fh or die "Cannot close file '$file': $!"; dd \@values;