Ah yes. Your monkish "Cruise Ship" director here. I thought this simple conditional would work just fine but I seem to have just missed some fine piece of logic.
I'm dumping an extracted HTML table of Cruise Ships (table is SHIPNAME,DATETIME,LATITUDE,LONGITUDE,CALLSIGN) to a csv file and one of the lines in the table is a break saying that the following "Ships in port or not reporting today:". So I thought I would break out of processing that line and then set a flag for all remaining ships ($in_port = "true").
However, all the output shows that the flag isn't being set and the line isn't being skipped in the output. Why is that? It's probably a real simple thing but I'm not seeing it.
my $in_port;
foreach my $ts ($te->tables) {
foreach my $row ($ts->rows) {
if ($row != "Ships in port or not reporting today:") # not a ship n
+ame; skip this and set the in_port flag for all remaining ships
{
$in_port = "false";
$out_fh->print (join(',', @$row), ",", $in_port, "\n");
}
else {$in_port = "true"};
}
}
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.