#!/usr/bin/perl use strict; use warnings; open(IN, '<', "cont.fil") or die "Cannot open cont.fil: $!\n"; my @fvalues; # Array, not a hash while() { # Reading values from below __DATA__ section, # change to for the data file. if (/^(\S+)/) { push @fvalues, $1; } } foreach my $value (@fvalues) { print "$value\n"; } close(IN); __DATA__ 58-OA-A0125 1 58-OA-A0244 2 58-OA-A0264 3 58-ST-A0112 4 58-ST-A0179 5