Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 chanting in the Monastery: (13)
As of 2015-07-02 22:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (46 votes), past polls