Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

(what are the evils of quoting lone scalars?) Re: Re: Should be simple, What don't I see?

by crazyinsomniac (Prior)
on Jun 14, 2002 at 11:54 UTC ( #174464=note: print w/replies, xml ) Need Help??


in reply to Re: Should be simple, What don't I see?
in thread Should be simple, What don't I see?

I forget, what are the evils of quoting lone scalars?

update: true, but why would anyone  $foo = "$foo" if ref $foo?

 
______crazyinsomniac_____________________________
Of all the things I've lost, I miss my mind the most.
perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"

  • Comment on (what are the evils of quoting lone scalars?) Re: Re: Should be simple, What don't I see?
  • Download Code

Replies are listed 'Best First'.
Re: Should be simple, What don't I see?
by Abigail-II (Bishop) on Jun 14, 2002 at 11:57 UTC
    Stringification of references is irreversable.

    Abigail

Re: (what are the evils of quoting lone scalars?) Re: Re: Should be simple, What don't I see?
by Abigail-II (Bishop) on Jun 14, 2002 at 12:18 UTC
    I don't understand your update. Is it a specific version if "why would anyone make a mistake"? I wouldn't know, but I'll keep warnings enabled and continue using strict anyway. Or do you mean why would they do:
    foo = "$foo" if ref $foo;
    In that case, I don't see what that has to do with the thread.

    Needless quoting of scalar is evil. You get into a habit where you easily make a mistake. Like quoting a ref. It might go well 99 times, but you are getting bitten the 100th time.

    Abigail

        Do you really consider my $email = "$firstName" . "_" . "$lastName\@email.com"; quoting of a lone scalar?

        I think it is, especially when you could just as well do:

        my $email = "$firstName\_$lastName\@email.com"; or ............"${firstName}_$lastName\@email.com";

        runrig - who has been doing too much VBScripting lately and is really appreciating perl's string interpolation.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2019-05-24 07:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (147 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!