Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

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?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2018-02-24 08:46 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (310 votes). Check out past polls.