my (@stamp, @name); foreach (@ll) { if (m#([A-Z][a-z]{2}\s\d{2}\s\d{2}:\d{2})\s(/.+\.+Z)$#) { push @stamp, $1; push @name, $2; } }