Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
laziness, impatience, and hubris
 
PerlMonks  

Re: Re: print datafields separated by tab

by thinker (Parson)
on Aug 23, 2003 at 16:52 UTC ( #286074=note: print w/ replies, xml ) Need Help??


in reply to Re: print datafields separated by tab
in thread print datafields separated by tab

Hi davido,

This is wrong in (at least) 2 regards. Firstly, the syntax is wrong in the while loop. What you needed was

while (my $line = <STDIN> ) {

Secondly, chomp does not return what you think it does. It returns the number of characters it removes, in your case 1 for each iteration. So your final result will be like

1    1    1

Hope this helps

thinker


Comment on Re: Re: print datafields separated by tab
Select or Download Code
Re: Re: Re: print datafields separated by tab
by davido (Archbishop) on Aug 23, 2003 at 17:05 UTC
    Wiping sleepy sand out of eyes..... Thanks for the head's up. I've fixed what should have been simple code. That will teach me to cut the 'test it first' corner. ;)

    By the way, you can see my use of chomp's seldom-used return value here: Chomped JAPH.

    Thanks again.

    Dave

    "If I had my life to do over again, I'd be a plumber." -- Albert Einstein

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2014-04-18 08:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (464 votes), past polls