I'm always grateful for your input.
I have 2 functions, in func1 any $t->print();
works fine. but func1 got too long and I created func2 
to continue on $t->print(); statements but it doesn't 
work because perl interpreter does not know what $t is.
so!, how can I associate $t in func2 to $t in func1,
and continue on $t->print(); statements?
regards,
Marco.
 
sub func1 {
     my ($forecast, $t);
     use Net::Telnet ();
     $t = new Net::Telnet;
     $t->open("$ip"); 
     $t->waitfor('/login: /');
     $t->print("OK");  
     $t->waitfor('/password: *$/i');
     $t->print("papa");
     $t-> waitfor( '/\-\> *$/i' ) ;
     $t-> prompt( '/\-\> *$/i' ) ;
  
    $t->print("pwd");
    ($forecast) = $t->waitfor('/\->/i');
    print $forecast;
#above $t->print("pwd"); works fine.
}
 
sub func2 {
#this $t->print("ls"); does not work.
#interpreter complains.
 
     $t->print("ls");
     ($forecast) = $t->waitfor('/\->/i');
     print $forecast;
}
#End

                
---------------------------------
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!

Reply via email to