|Just another Perl shrine|
Re^3: Undefined Value Error Messageby graff (Chancellor)
|on Mar 15, 2014 at 03:15 UTC||Need Help??|
Your code looks like spaghetti. I was actually surprised that it compiles, but I'm not surprised to see these warnings:
The cases of '"my" variable … masks earlier declaration' will probably mess things up.
The "unrecognized escapes" are cases where you seem to have an unnecessary backslash (or maybe you intended to put \" but didn't?)
The variables that "will not stay shared" happen because you're defining the "search" sub inside the scope of defining the "count" sub, the variables in question are declared (lexically scoped) inside "count", before sub search begins, and then they're being used inside "search".
That's a strange (and wrong) way to lay out subroutines. For example, consider what happens at start-up if the "reqpage" parameter you get is greater than 1: the "search" sub will be called without the "count" sub being called first, but the "$result_count" variable is only assigned a value (from a query) in the
There's also a missing double-quote at line 111 (the over-long line in the "heredoc"; this doesn't affect compiling, but it'll screw up your page display. (I noticed that because I used emacs with colorized text, and after that line, the coloring was inverted for code vs. string values).
So let me suggest:
(Updated to get the sub names right in the middle paragraph, and a grammar blot in the suggestion list.)