use strict; use warnings; use POSIX q(strftime); my @abc = ("a", "b", "c", "d", "e"); my $time=POSIX::strftime('%a, %d %b %Y %T %z', localtime); foreach (@abc) { print "[$time]\t$_\n"; sleep 5;}