in reply to CGI: Passing variables to a subroutine
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: CGI: Passing variables to a subroutine
by Anonymous Monk on Jan 05, 2007 at 01:41 UTC | |
|
Re^2: CGI: Passing variables to a subroutine
by stumbler (Acolyte) on Jan 04, 2007 at 21:52 UTC | |
by ikegami (Patriarch) on Jan 04, 2007 at 22:17 UTC | |
by friedo (Prior) on Jan 04, 2007 at 23:09 UTC |