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

my @lines = $$sess->->

This code simply makes no sense at all.

Your approach of passing the session is the normal way. There is no need to do any special things on the receiving side. You just use $sess in your subroutine as you would use $session in you main program.

Replies are listed 'Best First'.
Re^2: session as function argument in net:telnet:cisco
by mvcorrea (Novice) on Nov 16, 2013 at 18:29 UTC
    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.
      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.)