sub exec{ #... &log_action('error',$error); } sub log_action{ my $i = shift; #get first parameter my $error = shift; get second parameter # note that this $error here is not the same variable but has the same + value! #do whatever with it... }
You should also consult your Camel Book on Subroutines.
Hope this helps,
C-Keen
In reply to Re: passing a variable from one subroutine to another
by C-Keen
in thread passing a variable from one subroutine to another
by c
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |