in reply to [SOLVED] Issue with capturing STDOUT using tar and p7zip

Try running1 Run your $backupcommand in a subshell and redirect the output in its entirety:

... my $result = `( $backupcommand ) 2>&1`;

P.S.: you can interpolate variables into a double-quoted string, which makes it somewhat easier to read:

my $backupcommand = "tar -cvf - $directory/$seasonYear*.html | 7z a -m +x9 -si $backupdirectory/$seasonYear.tar.7z";

___

1 upd: just tried it myself — works fine.

Replies are listed 'Best First'.
Re^2: Issue with capturing STDOUT using tar and p7zip
by dblt1234 (Initiate) on Mar 18, 2012 at 20:03 UTC
    Worked perfectly, thanks!