use strict; use warnings; use Data::Dumper; $Data::Dumper::Terse=1; my $StatChk="cat /tmp/teststatus.txt | grep -v OK"; my $GoodStat="OK"; my @SChk_Out; open (DChk, "$StatChk |") || die "Failed: $!\n"; @SChk_Out = ; close (DChk); print "Output of command is =".Dumper(@SChk_Out); #### [ 'Station 7777: Not good. ', 'Station 7778: Not Good ' ] #### Station 7777: Not good. Station 7778: Not good.