in reply to Re: session as function argument in net:telnet:cisco
in thread session as function argument in net:telnet:cisco

sorry wrong paste! already corrected. I am missing something in the session reference passing.. thanks anyway,
Too many arguments for main::doOne at ./script.pl line 16, near "$sess +ion)" Execution of ./script.pl aborted due to compilation errors.

Replies are listed 'Best First'.
Re^3: session as function argument in net:telnet:cisco
by AnomalousMonk (Archbishop) on Nov 16, 2013 at 18:39 UTC
    Too many arguments for main::doOne ...
    sub doOne(){ ... }

    You define the  doOne() subroutine as taking no arguments (using the  () prototype; see Prototypes in perlsub), and then you try to pass it an argument when you invoke it. That won't work. In general, don't use prototypes unless you know what they are, what they do, and why you're using one in a particular instance. See Far More than Everything You've Ever Wanted to Know about Prototypes in Perl -- by Tom Christiansen.

    Update: mvcorrea: I see that the code in the OP has been 'fixed' again to remove the prototype from the  doOne() function definition (it was altered once before in response to Corion's reply), and again there is no notation that a critical alteration has been made. Please don't do this: it makes comments based on the original post seem incoherent. By all means, make changes to your posts, but please make a note of the changes within the changed post! (If you post as a registered user, you can always go back and edit your post.)