Net::Telnet with Perl
I need to telnet to a sunser via 9023 port.
Normally, I can telnet directly as below:
telnet 10.2.4.9 9023
Trying 10.2.4.9...
Connected to 10.2.4.9.
Escape character is '^]'.
900 Login required.
login username passwd
login username passwd
102 2 records.
Lucent NavisRadius Radius Server, Version 4.5.8 (Build 551-060)
Copyright (c) 1998-2005 Lucent Technologies Inc. All Rights Reserved.
==>
I tried to use Net::Telnet with the code following:
#!/usr/bin/perl -w
use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10,Port => 9023,Prompt => '/==> $/');
$t->open("10.2.4.9");
$t->waitfor("/900 Login required. $/i");
$t->print("login username passwd");
But it's not successful. This is the error message:
missing opening delimiter of match operator in argument "900 Login required.i" given to Net::Telnet::waitfor() at ./try line 5
How can i fix it ?
|