#!/usr/bin/perl use warnings; use strict; my $wantcols, '<', '/path/to/file1' or die '$!'; my @cols; while(<$wantcols>){ push @cols, split; } close $wantcols;