foreach my $min (20 .. 29) { foreach my $sec (@seconds) { my $SMPP_count = split (/[\s]/,(chomp(`cut -d "|" -f 1,10,13 SMSCDR*$date$hour$minute*.log |grep "Submit|SMPP" |grep "$hour:$min:$sec" |sort |uniq -c`)))[0]; print $SMPP_count; } }