in reply to Looping an SQL query

I strongly recommend that you use strictures (use strict; use warnings;). In this case your attention would have been drawn to the assignment to $sql which interpolates two undeclared variables ($dday, $msdn). It is interesting to note that these variables are given values inside a loop, but too late to affect the contents of $sql.

You need to construct $sql inside to loop after the variables have been initialized.


DWIM is Perl's answer to Gödel