This is a long list of suggestions, only the last of which will start to answer your actual question.
use strict -- you have subroutines assigning values to undeclared variables which the main body then assumes exist when it goes to the next statement. It woould be clearer to have things like:
my %form;
($form{'First'}, $form{'Last'}) = parse_form("First", "Last");
and this brings up
use CGI for parsing forms. It looks like this script attempts to parse form input on its own. A practice most Monks encourage avoiding when possible.
Finally, there is a module,
DBD::CSV to treat CSV files as SQL capable databases. By using a module you make it possible to switch to a more powerful SQL backend at any time.
In spite of all this, I still don't understand why you can't simply abandon the line number scheme altogether. As you loop throught the lines of data (assuming they are ordered in the file), you should simply be able to start pulling out lines where the catalog numbers are within the range.