use strict; use warnings; my @ll = ; my @items; chomp @ll; foreach (@ll) { next if ! m<([A-Z][a-z]{2}\s\d{2}\s\d{2}:\d{2})\s(/.+\.Z)>; push @items, {stamp => $1, name => $2}; } print "$_->{name}: $_->{stamp}\n" for @items; __DATA__ Jun 05 20:08 //B1006-cnvexp.20060605.200841.Z Jun 05 20:09 //B1106-cnvexp.20060605.2008.Z Jun 05 20:09 //B11062-cnvexp.20060605.2008.Z