in reply to Re^2: That damn "strict"
in thread That damn "strict"

I have the opposite quoting problem.

I am in the habit of always quoting with ", so that I won't have to change it if I later decide to interpolate a variable.

Which gives me no end of grief when it comes to SQL, because I constantly use " for strings and then wonder why it is complaining about my identifiers.

Replies are listed 'Best First'.
Re^4: That damn "strict"
by qbxk (Friar) on Jan 10, 2006 at 05:35 UTC
    lately started a job working with somebody who had written piles of code using qq{Look Ma! Double quoted string!} construct. it's a habit i think i may adopt, solves precisely this problem

    at one point, doing interpolation with a hash (for, perhaps, the 1000th time that day) a la:

    my %hash=(foo=>1); print qq{$hash{foo}};
    i wondered very intensely why that doesn't cause a syntax error, but then i came to my senses and stopped really caring ....

    It's not what you look like, when you're doin' what you’re doin'.
    It's what you’re doin' when you’re doin' what you look like you’re doin'!
         - Charles Wright & the Watts 103rd Street Rhythm Band
      hmmm, for me your code does cause an error
      adding a semicolon after the first line fixes this
      or am I missing the obvious?
      si_lence
        whoops.. that's not what i meant, i just missed the semicolon. (updated)

        It's not what you look like, when you're doin' what you’re doin'.
        It's what you’re doin' when you’re doin' what you look like you’re doin'!
             - Charles Wright & the Watts 103rd Street Rhythm Band
        That shouldn't make the strong weep. Reserve that for figuring out things like qq}$foo{bar\}}. Or somewhat more sanely, something like this: qq{let's have an unbalanced \{ here.}

        But that does bring up an important note. If you know that you'll want a quote with, say, unbalanced parens, then use a different balanced delimiter. For instance () above. (For me this mostly comes up with my having to use {} when I want unbalanced parens.)

      I use qq a lot as well, but mainly for whole blocks of text.