That does make sense. However, I think your problem is in this loop:
while ( <$contin> )
{
if ( $contractors =~ m/^$string(.*)/ )
{
my @results = split(m#\s+#, $1);
print br;
print @results;
}
}
close( $contin );
}
Specifically I think you're running into a problem at
if ( $contractors =~ m/^$string(.*)/ )
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 like
while ( <$contin> )
{
if ($_ =~ m/^$contractor(.*)/)
{
my @results = split(m#\s+#, $1);
print br;
print @results;
}
}
close( $contin );
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.