it seems you've fixed your immediate problem, although i see you've left yourself open to more problems in the future. i have a few suggestions:
sub BuildMMList { ## enforce strict programming methods (see strict) ## if you can't do this for the whole script, do it in each ## subroutine until the whole script has been refactored ## while you're at it, use warnings, too (see warnings) use strict; use warnings; ## pass parameters to the subroutine -- global variables are trouble ## assign the passed parameters to variables local to the scope of t +he sub my( $list, $mm_file ) = @_; ## use the three parameter form of open (see perlfunc) ## localize your filehandles to avoid namespace pollution ## don't quote variables unneccessarially (see perlvar) ## don't use the '&' sigil when calling subs (see perlsub) ## make your error messages verbose open( local *FILE, '<', $mm_file ) or error_message( "$0: Can't open data file: $mm_file: $!"); ## use a while loop to process the file in memory ## this avoids temp variables, and avoids c-like for loops while( <*FILE> ) { ## use the 3-arg form of split to limit fields ## throw away other fields by assigning to 'undef' my( $opt, undef ) = split /``/, $_, 2; ## use quote operators, so quote characters don't need to be escap +ed print qq{<option value="$opt">$opt</option>\n}; } }
i haven't tested this code, so there may be a bug or two lurking. anywhere i have a parenthesised note, you should use perldoc to find more info, or supersearch perlmonks for more.
i'm sorry i can't offer you more help (like using taint mode to safely process cgi params), but i hope this will get you started, and you'll go looking for more as you need it.
~Particle *accelerates*
In reply to Re^2: Split a database
by particle
in thread Split a database
by lisaw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |