in reply to Re: Timing out ``?
in thread Timing out ``?
Side note: I don't think @list = `ssh machine "ls path"`; does what you think it does; maybe you mean @list = split /\n/, `ssh machine "ls path"`;?
Yes it does:
In scalar context, it comes back as a single (potentially multi-line) string, or undef if the command failed. In list context, returns a list of lines (however you've defined lines with $/ or $INPUT_RECORD_SEPARATOR), or an empty list if the command failed.
perlop
So while the OP's way is safe, you'd even have to check for undef before splitting to avoid warnings on failure---which will even be fairly frequent in his use case.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Timing out ``?
by kennethk (Abbot) on Jun 07, 2012 at 00:05 UTC |