in reply to subroutine For ssh
perlsub explains this with examples.
Update: also tutorials->Subroutines.