On Jun 7, Byron Rendar said: >my $input = <STDIN>; > my $username = chop( $input ); >print "$username"; > >Why are double quotes around $username a "bad" thing in the print statement? They enforce stringification. This can be a problem when printing arrays, or sending references to functions: @array = <FILE>; print @array; # that looks ok print "@array"; # "why's there space in front of every line but the 1st?" $x = [ 1,3,5,7 ]; foo($x); # ok, prints 4 foo("$x"); # d'oh! sub foo { print scalar @{ shift() } } -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun. Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/ Acacia Fraternity, Rensselaer Chapter. Brother #734 ** Manning Publications, Co, is publishing my Perl Regex book **
- double quotes around a variable Byron Rendar
- Re: double quotes around a variable Peter Scott
- Re: double quotes around a variable Pete Emerson
- Re: double quotes around a variable Peter Scott
- Pel.org Page Works
- Re: double quotes around a variable M.W. Koskamp
- Re: double quotes around a variable Peter Scott
- Re: double quotes around a variable Brett W. McCoy
- Re: double quotes around a variable Randal L. Schwartz
- Re: double quotes around a variable Brett W. McCoy
- Re: double quotes around a variable Jeff 'japhy' Pinyan
- Re: double quotes around a variable Karen Cravens
- Re: double quotes around a variable Jeff 'japhy' Pinyan
- Re: double quotes around a variable Karen Cravens
- Re: double quotes around a varia... Peter Scott
- Re: double quotes around a v... Jeff 'japhy' Pinyan
- Re: double quotes around a v... Chas Owens
- RE: double quotes around... Travis Smith
- [OT]RE: double quotes ar... Chas Owens
- [OT] and/or operator Michael Fowler
- Re: double quotes around a v... Karen Cravens