Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: subroutine For ssh

by davido (Cardinal)
on Oct 08, 2019 at 15:28 UTC ( #11107210=note: print w/replies, xml ) Need Help??

in reply to subroutine For ssh

In addition to the other resources mentioned in this thread, I would suggest the best document to read before going any further with Perl would be perlintro, which contains a section about writing subroutines. The value in perlintro is that it contains just enough on a broad range of Perl topics to inform the rest of your progress toward learning the language, yet takes less than a half hour to read in its entirety.

Learn Perl in about 2 hours 30 minutes is another gem; one that the Mojolicious project lists in its documentation as reference material for people newly coming to Perl.

perlintro takes 20-30 minutes to read. Learn Perl in about 2 hours 30 minutes takes...well, 2 hours and 30 minutes. But the sections on subroutines take about 5 minutes total, and should help you to come to a better understanding.

For your specific case, you need something like this:

sub SSHApp { my ($MyUser, $MyPass, $MyIP) = @_; # ...the rest of your code goes here. # You probably need: # my $output = $ssh_1->cmd('sh version'); return $output; }


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11107210]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2023-09-22 07:51 GMT
Find Nodes?
    Voting Booth?

    No recent polls found