Since you really need to escape a number of characters, use the URI
escape module

http://search.cpan.org/~gaas/URI-1.35/URI/Escape.pm

The modified example would be:
----

use Net::Telnet;
use URI::Escape;

my @cmd;
my $result;

$cmd = $ARGV[0];

foreach (@ARGV) {
push (@cmd, uri_escape($_));
}

$t = new Net::Telnet (Timeout => 10);
$t->open(Host => "localhost", Port => 9090);
$t->print("@cmd");
$result = $t->getline;
$t->print("exit");
print $result;

----

Your command line will then not require quotes, except to escape chars
from cmd.exe.

perl testit.pl Arg1 Arg2 ...


-- 
MrC
------------------------------------------------------------------------
MrC's Profile: http://forums.slimdevices.com/member.php?userid=468
View this thread: http://forums.slimdevices.com/showthread.php?t=26293

_______________________________________________
discuss mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/discuss

Reply via email to