in reply to Obtaining data from the top command via a pipe

You don't really want to join the pipe. Nor do you likely want "-n 3". You probably want "-n 1".

#!/usr/bin/perl open PIPE, "/usr/local/bin/top -b -n 1 |" or die "Cannot open pipe"; my ($output) = grep /^CPU states:/, <PIPE>; close PIPE or die "Running top failed"; print "$output\n"; exit(0);

Hope that helps,