I've never seen the syntax
@file = ; (and
I'm not doubting you, just curious) but are you checking to
see what the contents of @file are before you enter the
while loop? Also you should be sure to put
chomp @file;
before the loop since you might have newlines in the file
at the end of each record (
"\n").
Keep us posted.
--Jim
Afterthought: It is usually helpful when I'm
debugging to use snippets similar to the following for
testing arrays:
my $i = 0;
foreach (@file) {
print "\@file[", $i++, "] = '$_'\n";
}
It helps spot newlines, incorrect subscripting and such.
Update: In case it is not clear from the previous
posts, we're assuming that the file 'd:\mms_tableload.txt'
looks like this:
sarak_mike\n
mike\n
some\n
other\n
data\n
The hash lookup must be an exact match (including newlines
and case sensitivity). If there is other extraneous
information like HTML tags embedded in @file, then you may
need to use a different method that
searches strings
(like grep, or m/$_/), and this can be tricky since you'd
have to insure that your search for "mike" doesn't match
positve to "sarak_mike".
</code>
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.