oomwrtu has asked for the wisdom of the Perl Monks concerning the following question:
Thank you very much in advance, you guys have been a lot of help already!if( $options{"display"} eq "1" ) { print "<table border=\"1\" cellpadding=\"1\"" . "cellspacing=\"1\">\n"; print "<tr><td>ID</td><td>Name</td><td>Size</td>" . "<td>Percent</td><td>Decimal</td><td>Land" . "</td><td>Owner</td>"; if( $options{"coordinate"} eq "1" ) { print "<td>Location</td></tr>\n"; } else { print "<td>X</td><td>Y</td></tr>\n"; } } else { print "ID,Planet Name,Size,Land Percentage,Land" . "Decimal,Actual Land,Owner,"; if( $options{"coordinate"} eq "1" ) { print "Location<br>\n"; } else { print "X,Y<br>\n"; } } for( my $i = 0; $i <= $planets; $i++ ) { split(/,/, $data[$i]); next if( $options{"unoccupied"} eq "0" && $_[6] eq "unoccupied\n" ); print $data[$i] . "<br>\n" if( $options{"display"} eq "0" && $options{"coordinate"} eq "0" ); print "$_[0],$_[1],$_[2],$_[3],$_[4],$_[5],$_[6]" . ",($_[7],$_[8])<br>\n" if( $options{"display"} eq "0" && $options{"coordinate"} eq "1" ); print "<tr><td>$_[0]</td><td>$_[1]</td><td>$_[2]" . "</td><td>$_[3]</td><td>$_[4]</td><td>$_[5]</td>" . "<td>$_[6]</td><td>$_[7]</td><td>$_[8]</td></tr>\n" if( $options{"display"} eq "1" && $options{"coordinate"} eq "0" ); print "<tr><td>$_[0]</td><td>$_[1]</td><td>$_[2]</td>" . "<td>$_[3]</td><td>$_[4]</td><td>$_[5]</td><td>$_[6]</td>" . "<td>($_[7],$_[8])</td></tr>\n" if( $options{"display"} eq "1" && $options{"coordinate"} eq "1" ); delete $data[$i]; } print "</table>" if($options{"display"} eq "1"); print "\n<br><br>time to run: " . (times)[0]; exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Printing data from a file in various ways
by liverpole (Monsignor) on Oct 12, 2005 at 19:45 UTC | |
|
Re: Printing data from a file in various ways
by Skeeve (Parson) on Oct 12, 2005 at 19:32 UTC | |
|
Re: Printing data from a file in various ways
by graff (Chancellor) on Oct 13, 2005 at 04:56 UTC | |
by oomwrtu (Novice) on Oct 14, 2005 at 02:18 UTC | |
by graff (Chancellor) on Oct 14, 2005 at 12:50 UTC |