Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^5: tabular format of data

by tangent (Priest)
on Feb 18, 2012 at 01:54 UTC ( #954666=note: print w/replies, xml ) Need Help??


in reply to Re^4: tabular format of data
in thread tabular format of data

You haven't used JavaFan's example properly, look at it again.
If you want to print a table using the same data structure, you could do:
print qq|<table border="1">\n|; foreach my $line (@data) { print qq|<tr>|; print qq|<td>$_</td>| for @$line; print qq|</tr>\n|; } print qq|</table>\n|;
I use qq|| to quote the string to avoid problems with border="1"
Prints:
<table border="1"> <tr><td>A</td><td>B</td></tr> <tr><td>C</td><td>D</td></tr> </table>
though you're probably better off using a module as you will find yourself doing this kind of thing often

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://954666]
help
Chatterbox?
[shmem]: moin Corion, karlgoethebier. I stumbled over <<>> occasionally on the p5p mailing list
[Discipulus]: not noticed
[karlgoethebier]: sometimes rereading manages is helpful ;-) at least for me...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2017-07-21 07:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (319 votes). Check out past polls.