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

Re: I feel stupid... 2 hours later

by 2teez (Priest)
on Nov 24, 2012 at 07:10 UTC ( #1005338=note: print w/ replies, xml ) Need Help??


in reply to I feel stupid... 2 hours later

Hi sdyates,
Why not use the module Text::CSV or Text::CSV_XS to read your CSV files.

However, the <tr> shows up at the beginning of the output file and the </tr> shows up at the end. I want to get them to show up at the beginning and end of each line

You could put your code print OUTPUT "<tr>"; and print OUTPUT "</tr>"; within the foreach loop.
Or you could write like so:

foreach my $cell (@cells) { print OUTPUT "<tr><td>$cell</td></tr>"; }

Update: I think I misunderstood, the show up at the beginning and end of each line
Kenosis's solution shown below is alot better, using Text::CSV.

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me


Comment on Re: I feel stupid... 2 hours later
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (16)
As of 2015-07-30 15:58 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 (273 votes), past polls