Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How to read data from csv file and place the data on HTML format

by Tux (Monsignor)
on Jun 27, 2013 at 06:55 UTC ( #1040927=note: print w/ replies, xml ) Need Help??


in reply to How to read data from csv file and place the data on HTML format

Your parsing is unsafe and you are not returning html and you are printing references instead of fields

use Text::CSV; use HTML::Entities; sub ConvertData { my $csv = Text::CSV->new ({ binary => 1, auto_diag => 1 }); open my $fh, "<", $Filename or die "Couldn't open location file $F +ilename: $!"; my @report = ("<table>"); while (my $row = $csv->getline ($fh)) { push @report, "<tr>"; push @report, "<td>", encode_entities ($_), "</td>" for @$row; push @report, "</tr>"; } push @report, "</table>"; close $fh; return join "\n" => @report; }

Enjoy, Have FUN! H.Merijn


Comment on Re: How to read data from csv file and place the data on HTML format
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1040927]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2014-08-23 03:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (172 votes), past polls