It is a bit weird, but I could workaround it by first joining  the value,
and splitting it thereafter:

@splitted = split /\s+/, join "", @found;

Thanks anyway...



||-----Original Message-----
||From: Babale Fongo [mailto:[EMAIL PROTECTED]
||Sent: Wednesday, February 02, 2005 11:59 PM
||To: beginners@perl.org
||Subject: Net::SSH (How to split value returned by a system command)
||
||This is what I had:
||
||@found = remote_cmds ("find $remdir  -name '*.zip'");
||
||print "@found" look like this:
||
||/path/file1.zip
||/path/file2.zip
||/path/file3.zip
||
||@found is neither a list nor string, so it is not handy to deal with.
||
||
|| In scalar context, the command returns 1 (true), in list context it
returns
||a list of files (one per line).
|| But the value of @found is not a list, but I can't split it either.
||
|| I tried: @splitted list = spilt /\n/, @found; # didn't work!
||@splitted list = spilt / /, @found; # didn't work either
||
||Has anyone an idea on how split the return?
||
||sub remote _cmds {
||
||      my $cmd = shift;
||
||      my @ret = ssh_cmd ({
||                             host => "$host",
||                   user => "$user",
||                   command => "$cmd"
||            }) || die "$!";
||
||            return @ret;
||
||
||}




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to