Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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

by Tux (Abbot)
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 meditating upon the Monastery: (2)
As of 2016-09-25 01:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (463 votes). Check out past polls.