Now, you can set the global $var to by equal to the return value of the subroutine. Also, you can just print the return of the subroutine if you like. return is a very handy tool when it comes to subroutine programming and cleaning up perl code.my $xyz = 15; my $var = &example($xyz); print &example($xyz); sub example { my $tmp = shift || 0; my $tmp += 49; return $tmp }
In reply to Re: Re: subroutine syntax
by marius
in thread subroutine syntax
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |