in reply to Re^3: How to monitor/look for output?
in thread How to monitor/look for output?

Basically, the output that I would be looking for that returns from the other commands is:

XX files copied (where XX is a number)

Restored successfully

If I run the commands in backticks, and have that placed in an array, like @output = `command`, would it then be best to do a foreach loop to look for that output?

Replies are listed 'Best First'.
Re^5: How to monitor/look for output?
by kennethk (Abbot) on Jun 04, 2009 at 15:21 UTC
    Like I said, backticks return a scalar, so you should run $output = `command`, though calling an input $output is a little confusing. Assuming that 'Restored successfully' is the last line and only returned on success, you could do something like:

    $backup_return = `command`; die "Backup failed: $backup_return\n" unless $backup_return=~/Restored + successfully/; $other_return = `second command`;