Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
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 lurking in the Monastery: (14)
As of 2014-08-20 09:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (109 votes), past polls