mcoblentz has asked for the wisdom of the Perl Monks concerning the following question:
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"}; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Setting flags in a conditional
by BrowserUk (Patriarch) on Mar 20, 2008 at 05:55 UTC | |
by mcoblentz (Scribe) on Mar 20, 2008 at 06:04 UTC | |
by mcoblentz (Scribe) on Mar 20, 2008 at 06:11 UTC | |
by BrowserUk (Patriarch) on Mar 20, 2008 at 06:44 UTC | |
by mcoblentz (Scribe) on Mar 20, 2008 at 21:43 UTC | |
|