I see that you fixed one "unreachable code" problem...
Op should be aware of this in his code:
To be inside of the while (<MAPPINGFILE2>) { loop means that you are not at the eof yet. When this while loop finishes, MAPPINGFILE2 will be eof, but not before.
UPDATE: I decided that this is not right. The read of the very last line will consume all characters and hence reach eof. So you can reach eof before a read of <MAPPINGFILE2> would return an undef (the normal way to detect eof).
while (<MAPPINGFILE2>) {
chomp();
# Skip blank lines and comments
next if /^(\s*(#.*)?)?$/;
# Split mapping columns (tab)
@mapping = split /\t/, $_;
# Mapping is matching
if ($line =~ m/$mapping[0]/) {
$line =~ s/$mapping[0]/$mapping[4]/;
@source = split /\t/, $line;
$line =~ s/$source[2]/$mapping[2]\tALLOC_$sour
+ce[2]/;
push @lines2, $line;
last;
} elsif (eof(MAPPINGFILE2)) { #correction: ######
+Can happen
push @rejects, "Lignes non mappées (Account):
+"."\t".$line;
}
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|