in reply to Why cant i save output of tasklist.exe in an array?

As other monks mention - your problem is you overwrite the array

@cmdout = <DDDD>;

Will probably do what you want.

On a more general style point - I would suggest strongly that you use 3 argument open, instead of two arg, because interpolated variables are a good way to introduce bugs.

open ( my $dddd_fh, "|-", $BACKUPSTATE ); my @cmdout = <$dddd_fh>; chomp(@cmdout); print Dumper(@cmdout);