sub mysub { my ( $var1, $var2 ) = @_; rest of your process } Call with: mysub($var1, $var2);
It's all in the learning perl book, it's probably easiest to start there.
EDIT: No ampersand before the subroutine's name!
In reply to Re: Perl : Convert a monolithic code to a function
by 1s44c
in thread Perl : Convert a monolithic code to a function
by user786
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |