#populate @ABC for pourposes of the test @ABC = qw[ticket1 ticket2 ticket3]; foreach my $ticket (@ABC) { my $line = qx{/usr/local/bin/ticket $ticket}; # print qx{.... would also accomplish this # assuming you want to do more to $line than print print $line; }