GC has asked for the wisdom of the Perl Monks concerning the following question:
#!perl -w use strict; use CGI qw(:standard escapeHTML); ############# print header(), start_html("Search Results"); ############ my $string = param("submit_zip"); my $inputs = 'zip-acc.txt'; open( my $in, '<', $inputs) or die "can't open $inputs.\n"; while ( <$in> ) { if ( $_ =~ m/^$string(.*)/ ) { print "$1\n"; print br; print br; my @contractors = split(m#\s+#, $1); my $continputs = 'acc-addy.txt'; my $contractors; foreach $contractors(@contractors) { open( my $contin, '<', $continputs) or die "Cannot open $i +nputs.\n"; while ( <$contin> ) { if ( $contractors =~ m/^$string(.*)/ ) { my @results = split(m#\s+#, $1); print br; print @results; } } close( $contin ); } } } close( $in ); ############ print end_html(); ############
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using elements to search a file
by jpearl (Scribe) on May 06, 2009 at 17:29 UTC | |
by GC (Initiate) on May 06, 2009 at 17:55 UTC | |
by jpearl (Scribe) on May 06, 2009 at 18:23 UTC | |
by GC (Initiate) on May 06, 2009 at 18:33 UTC | |
|
Re: Using elements to search a file
by Narveson (Chaplain) on May 06, 2009 at 16:23 UTC | |
by GC (Initiate) on May 06, 2009 at 16:26 UTC |