I need something similar to
Combining while statements or
Re: Combining while statements. The idea is to grab search results out of 2 tab delimited text files but keep the results of each file in separate scalers or maybe arrays to be printed separately later. I have
HTML::Parser installed but the script utilizes:
use Fcntl qw(:DEFAULT :flock);
use CGI;
use CGI::Carp qw(fatalsToBrowser);
Example of tab delimited file:
20645 CJ Sports Sportswear and equipment retailer specialising
+in rugby, hockey, netball and cricket. Full product details and o
+rdering available online. www.cj-sports.co.uk/
20660 Gekko Gear Selection of winter sports apparel.
+ www.gekkogear.com/
open (SIDX, "$data_dir/search.idx");
open (SIDX2, "$data_dir/search2.idx");
if ($file_locking ne "No"){flock (SIDX, LOCK_SH) or die "Can't set lo
+ck for file: $data_dir/search.idx, $data_dir/search2.idx $!\n";}
while (defined($line=<SIDX2>) and ($premiumline=<SIDX2>))
{
$sline = $line, $premiumline;
foreach $kwr (@skeyw, @premiumkeyw)
{
if (($sline =~ /$kwr/i) and ($kwr ne ""))
{
$toadk = "true";
}
}
if ($toadk eq "true")
{
$resultline[$icnt] = $line;
$toadk = false;
$icnt++;
}
}
#if ($file_locking ne "No"){flock (CIT, LOCK_UN);}
close (SIDX);
close (SIDX2);
}
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.