To much work!
use CGI; my $query = CGI->new(); if ($query->param( "button" ) eq 'first') { display_first( $query ) } else { display_second( $query ) } sub display_first { my $query = shift; # declare your variables here } sub display_second { my $query = shift; # declare your variables here }
There is no reason to declare all your variables when they are already in the $query object. Just pass the query object and in the routine assign values to the variables as you need them. No more, no less.
In reply to Re: CGI: Passing variables to a subroutine
by Herkum
in thread CGI: Passing variables to a subroutine
by stumbler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |