On Wed, Dec 19, 2001 at 03:33:59PM -0500, Paul Kincaid wrote: > #!/usr/bin/perl -w > > # Program for logging into Foundry and Cisco switches/routers > # and backing up specific information > > use strict; > use Net::Telnet; [snip] > sub start { > > package Start; > my ($t, @output, $prompt); [snip] > }; > > sub Start::login { > my ($passwd, $en); > $passwd = "mypasswd"; > $en = "en"; > $Start::t->waitfor('/password/i'); ##### this is line 39 > $Start::t->print($passwd); > $Start::t->print($en); > $Start::t->waitfor('/password/i'); > $Start::t->print($passwd); > }; > > sub Telnet_in::identify { [snip] > }
> sub Start::Identify::cisco_skip { [snip] > } You have some very strange things going on here with packages. They are not generally used in this manner, and I'm not certain you know what you're doing. Anyways, your problem lies with how you declare $t in start(). You declare it as a lexical variable. It's not a package global, so you can't access it as $Start::t, and its scope ends at the end of start(), so you can't access it outside of that subroutine. To fix your immediate problem declare $t with our or use vars. If this is how your code actually looks, and its confined to one script, then do away with the seperate packages. Keep everything in main:: (the default package) and it'll be less confusing to you and to anyone maintaining it. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]