#!/usr/bin/perl use warnings; use strict; my @commands = ( 'sleep 3 && find /usr/share/doc', 'sleep 4 && find /opt', 'sleep 5 && df' ); my @fhs; for my $i (0 .. $#commands) { open $fhs[$i], '-|', $commands[$i] or die "Can't run $commands[$i]"; } for my $i (0 .. $#commands) { print "=== $commands[$i] ===\n"; print while readline $fhs[$i]; }