Hi, thank you again list members for the quick response to my last question.
I am using the I am trying to figure out to pass my $exp to the subroutine "grabConfig". $exp is the variable of my expect object. line 167 is "$patidx = $exp->expect($timeout, [$prompt]); " here is the error message: " Please Enter Selection: > Can't call method "expect" on an undefined value at ./get.config.pl line 167." here are snippets from my code: ---- snip --- # send element number while ($elementCount < $elementUpperLimit) { $prompt = "$blah"; $exp->send("$elementCount"); &grabConfig; $elementCount++; } sub grabConfig { $prompt = "[EMAIL PROTECTED]>"; $patidx = $exp->expect($timeout, [$prompt]); <<<<<< line 169 $read = $exp->before(); #get hostname $read =~ /^@([^>]+)>\s/; $hostname = $1; $hostname = tr/[a-z]/[A-Z]/; $outputFilename = "$hostname.config.txt"; #delete saved configuraiton file unlink ($outputFilename); # open new configuration file open (OUTPUT, ">$outputFilename"); ---- snip ---- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/