tty1x has asked for the wisdom of the Perl Monks concerning the following question:
The output I expected after entering 'aaa' as input :#!/usr/bin/perl –w print "Please enter your name\n"; chomp($name = <STDIN>); print "Thank you $name";
but the output came up to be :Please enter your name aaaThank you aaa[root Shared]#
I assumed Chomp has already removed the /n character for STDIN, why has the next print still print on a new line ?Please enter your name aaa Thank you aaa[root Shared]#
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Relationship between chomp() operator and STDIN
by Athanasius (Archbishop) on Apr 30, 2013 at 04:43 UTC | |
by tty1x (Novice) on Apr 30, 2013 at 05:01 UTC | |
by davido (Cardinal) on Apr 30, 2013 at 05:16 UTC | |
by tty1x (Novice) on Apr 30, 2013 at 06:17 UTC | |
by Random_Walk (Prior) on Apr 30, 2013 at 05:17 UTC | |
Re: Relationship between Chomp() operator and STDIN
by NetWallah (Canon) on Apr 30, 2013 at 05:10 UTC |
Back to
Seekers of Perl Wisdom