in reply to CGI scoping question

Why would index not be 10

Perhaps $q is not defined, add this line to check

die "\$q not defined" unless defined $q; my $index = $q->param('orderby');
poj

Replies are listed 'Best First'.
Re^2: CGI scoping question
by WoodyWeaver (Monk) on May 10, 2019 at 18:22 UTC
    I'm using $q in the global, so having it vanish in the subroutine would be interesting indeed. Added that check line, but no joy. Just now I had a case where
    <li><strong>orderby</strong></li> <ul> <li>10</li> </ul> <li><strong>desc</strong></li> <ul> <li>1</li>
    yet
    <!-- variables (index, desc) are (10, ) -->
    The previous instance of the CGI variable would have correctly had the desc parameter undefined, but *this* one seems to be set.