Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: I feel stupid... 2 hours later

by monsoon (Pilgrim)
on Nov 24, 2012 at 07:15 UTC ( #1005339=note: print w/ replies, xml ) Need Help??


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

your EOL character in the input file is CR (0x0D), so the entire file reads into 1 line. Change the line separator to CR and chomp your lines.

$/ = "\r"; while ($line=<F>) { chomp $line; print OUTPUT "<tr>"; my @cells= split ',',$line; foreach my $cell (@cells) { print OUTPUT "<td>$cell</td>"; } print OUTPUT "</tr>\n"; }


Comment on Re: I feel stupid... 2 hours later
Download Code
Re^2: I feel stupid... 2 hours later
by sdyates (Scribe) on Nov 24, 2012 at 12:12 UTC
    2tees thanks so much for your explanation. I thought about chomp, but thought it was only required when reading STIN from a user. And, yes, it was reading in the entire file. Thanks so much for the explanation. Moonson had the correct solution, but your explanation helped me learn from my mistakes. Its amazing what a few years away can do to a person's skills. I obviously need more practice. Thanks so much!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1005339]
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: (4)
As of 2015-07-05 13:21 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 (67 votes), past polls