Here'a quick update for eveyone who offered help:
First: THANKS!! You guys and gals are great. Your comments and thoughts proved most useful, and helped me think about my problem from a different viewpoint, which ultimately proved to solve my problem. A special thanks to 'beable' who told me about the Tie::File module, which for all intents and purposes saved my bacon. I will note, however, that Perl PPM was less than successful in installing this particular module (as well as a number of others, which leads me to believe that the problem is, perhaps, me... :) )...After much reasearch, however, I was able to install this handy module the archaic way.
In anycase, this may not be the most efficient way of doing this, but it works, and that's all I needed. Here's the code that solved my problem:
tie @array, 'Tie::File', "mdfl.txt";
foreach $line (@update) {
chomp $line;
@bob = split (/\t/, $line);
$dmpiid = $bob[0];
$new = $bob[1];
$ln = "-1";
{
foreach $element (@array) {
$ln ++;
if (($element) =~ (/$dmpiid/)) {
print "Match found at $ln\n";
$slice = $array[$ln];
@fred = split (/\t/, $slice);
$dmpi = $fred[0];
$benum = $fred[1];
$os = $fred[2];
$name = $fred[3];
$lat = $fred[4];
$long = $fred[5];
$last = $fred[6];
$curr = $fred[7];
$last = $curr;
$curr = $new;
$array[$ln] = "$dmpi\t$benum\t$os\t$name\t$lat\t$long\t$last\t$curr";
next;
}
}
}
}
untie @array;
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.