Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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"; }

Replies are listed 'Best First'.
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?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (11)
As of 2016-10-21 17:01 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (289 votes). Check out past polls.