cal has asked for the wisdom of the Perl Monks concerning the following question:
@toy = ("Jan","Feb","Mar","Apr"); &search_database(@toy); sub search_database{ my $search_for = $_[0]; open(DB, $database) or die "Error opening file: $!\n"; while(<DB>){ if($search_field =~ /all/i){ if(/$search_for/oi){push @results, $_}; } else { ($key,@field_vals) = split(/\::/, $_); if($field_vals[$search_field] =~ /$toy/oi){push @results, $_}; } # End of else. } # End of while. close (DB); } # End of search_database subroutine...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need help with toy array. THX
by Zaxo (Archbishop) on Sep 16, 2002 at 05:44 UTC | |
by csotzing (Sexton) on Sep 16, 2002 at 11:01 UTC | |
by charnos (Friar) on Sep 16, 2002 at 13:12 UTC | |
|
Re: Need help with toy array. THX
by kabel (Chaplain) on Sep 16, 2002 at 05:33 UTC |