in reply to Re^2: Using elements to search a file
in thread Using elements to search a file
Specifically I think you're running into a problem atwhile ( <$contin> ) { if ( $contractors =~ m/^$string(.*)/ ) { my @results = split(m#\s+#, $1); print br; print @results; } } close( $contin ); }
It looks like what you want to be doing is matching every line in $contin against your current $contractor where what you're actually doing is matching $contractor against your regex ^$string(.*) Try changing the above regex in the while loop to have something likeif ( $contractors =~ m/^$string(.*)/ )
while ( <$contin> ) { if ($_ =~ m/^$contractor(.*)/) { my @results = split(m#\s+#, $1); print br; print @results; } } close( $contin ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Using elements to search a file
by GC (Initiate) on May 06, 2009 at 18:33 UTC |