in reply to Re: declare and init a scalar
in thread declare and init a scalar

I've got into the habit of using q{ ... } and qq{ ... } because I work in both Unix/Linux and MS Windows environments. They mean I don't have to think about the quoting conventions of the o/s when writing one-liners, which in practice tend to be several-liners.

Update: Corrected typo above, s/it //, and to clarify, I use quoting constructs everywhere, scripts and one-liners.

Cheers,

JohnGG

Replies are listed 'Best First'.
Re^3: declare and init a scalar
by BrowserUk (Patriarch) on Jan 22, 2015 at 22:58 UTC
    I've got into the habit of using q{ ... } and qq{ ... } because it I work in both Unix/Linux and MS Windows environments. They mean I don't have to think about the quoting conventions of the o/s when writing one-liners,

    That is the most (only) cogent argument I seen for this practice.

    However, given that you have to think about whether to use -E' ... ' or -E" ... " in the first place, within that, choosing to use q[ ... ] or qq[ ... ] when appropriate doesn't seem so hard.

    And limiting that use to just one-liners, less so.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
    In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked
      but then the noobers who get the oneliners don't understand '' "" of their own shell ... easiest just to change one pair of quotes rather than many
      Too bad that perl -Eq{...} doesn't work - though probably for different reasons on different OSes :-)
        Too bad that perl -Eq{...} doesn't work - though probably for different reasons on different OSes :-)

        Nah! Perl has no equal on any OS :)


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
        In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked