Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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

by GrandFather (Sage)
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1009272]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2016-12-06 02:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (96 votes). Check out past polls.