Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: In Love With Double Quotes

by danb (Friar)
on Aug 08, 2005 at 16:16 UTC ( #481927=note: print w/ replies, xml ) Need Help??


in reply to In Love With Double Quotes

I'm surprised that no one has mentioned my favorite reason for using single quotes instead of double quotes (in this discussion or the last): more whitespace. Whitespace is pretty, and ' takes half as many pixels as ". Witness:

my $foo = "fhwgads"; if ( $foo eq "fhwgads" ) { print "fh" . "wg" . "ads"; }
my $foo = 'fhwgads'; if ( $foo eq 'fhwgads' ) { print 'fh' . 'wg' . 'ads'; }
Doesn't the second example look *so* much better? Ahh, the beauty. Maybe I like whitespace a little too much?

--Dan


Comment on Re: In Love With Double Quotes
Select or Download Code
Re^2: In Love With Double Quotes
by trammell (Priest) on Aug 08, 2005 at 18:02 UTC
    I can think of two reasons to use " by default instead of ':
    1. To disambiguate when using lots of `s, if your font isn't clear
    2. Easier to write text that uses contractions, e.g.
      open(my $fh, '/etc/motd') || die "Can't open /etc/motd: $!";
    YMMV.
Re^2: In Love With Double Quotes
by Anonymous Monk on Aug 09, 2005 at 08:53 UTC
    Do you also write:
    s.foo.bar.
    instead of
    s/foo/bar/
    or does your "more whitespace" rule only apply to string quotes?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2014-12-20 05:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (95 votes), past polls