Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: Question why my code is posting a new line

by GrandFather (Cardinal)
on Dec 18, 2012 at 03:49 UTC ( #1009272=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Question why my code is posting a new line
in thread Question why my code is posting a new line

No. Athanasius is implying that:

my $price = <STDIN>;

reads an entire line including the end of line character(s) into $price. Perl doesn't "add" the new line, it was there in the input. chomp may be used to remove a trailing line end.

Most often the line end is represented in Perl strings as \n regardless of operating system. In various cases is can be other strings (for example when the content of $/ has been changed).

True laziness is hard work


Comment on Re^3: Question why my code is posting a new line
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2014-08-22 00:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (144 votes), past polls