Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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 grasshoppers chirp...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2018-05-23 23:42 GMT
Find Nodes?
    Voting Booth?