It looks like you set $page to "" and then possibly set it to undef in the following line if there is no query parameter named "page". By the time perl compares $page to 'main', it's getting an undef value.
You probably meant something like: my $page = $query->param("page") // '';
or: my $page = $query->param("page") || '';
In reply to Re: string initialization error
by perlancar
in thread string initialization error
by *alexandre*
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |