http://www.perlmonks.org?node_id=581720


in reply to Re: RFC: A Primer on Writing Portable Perl Programs
in thread RFC: A Primer on Writing Portable Perl Programs

That's a good point, but at the expense of doubling the number of 'quoting' characters that needs to be typed ("x" vs. qq{x}), I don't think it would catch on as a routine practice. However, as a "best practice" for depicting one-liners meant for portability, I like it!
*=========================================================================*
| Dr. Tim Maher, CEO, Consultix
| Email: tim@consultix-inc.com
*=========================================================================* 

Replies are listed 'Best First'.
Re^3: RFC: A Primer on Writing Portable Perl Programs
by pKai (Priest) on Nov 01, 2006 at 20:23 UTC
    doubling the number of 'quoting' characters…("x" vs. qq{x})

    In the realm of your discussion it's (\"x\" vs. qq{x}) which makes the score even.

    I don't think it would catch on as a routine practice.

    It is routine practise, but that may be only me. For one I don't like "external" characters inside my perl code (the backslash belonging to the cmd.exe, and is not seen by perl), and secondly it's actually easier to parse when read (for my brain at least).

    Update: The original proposition from mirod came from the -ix side. My remarks are coming from the Win command line ;-)

      doubling the number of 'quoting' characters…("x" vs. qq{x})

      In the realm of your discussion it's (\"x\" vs. qq{x}) which makes the score even.

      I don't think it would catch on as a routine practice.

      It is routine practise, but that may be only me. For one I don't like "external" characters inside my perl code (the backslash belonging to the cmd.exe, and is not seen by perl), and secondly it's actually easier to parse when read (for my brain at least).

      It is not only you, pKai. I also routinely make a practice of using some alternate Perl quoting delimiters, when writing a one-liner for Windows/CMD or one that I think might ever run on Windows/CMD.

      In my experience it only takes a little practice to "see" the quoted string standing out clearly when using a q<some-char> construct, just as or nearly as easily as one without practice does with ordinary "s. But then I write a lot of Perl.

      Since it is tangential to this reply I won't go deeply into it, but one pet peeve of mine concerns assumptions about what shell a Win32 Perler is using. There are UNIX sh -like shells being used on MS Windows. There's a special environmental variable, PERL5SHELL, addressing that. Yet most all of the core Perl utility code (i.e. for things like ExtUtils) assumes that a command interpreter on Windows has to be the CMD.exe or command.com type. I feel a bit mistreated ;-). The 3 people still using MINT systems get support, but I as part of who knows how many hundreds or thousands using a 3rd-party UNIX-like shell on MS Windows cannot? By what logic exactly? Because there's so few of us? Only in relation to the total user base for MS Windows. So 3 MINT users or 48 FooIX-1.0 users get support, but trying to use MS Windows better gets us punishment? ;-)

      Yumpy, you'll find some more MS Windows / Perl portability notes (especially relating to the creation of DOSKEY macros to fill the role that BASH functions do, in the CMD shell), on my home node. Down past the "meta" stuff relating to my experience in 6 years here at Perlmonks. Ignore the growling and squeals of moral distress if that's not what you're into. ;-)

          Soren A / somian / perlspinr / Intrepid

      -- 
      Words can be slippery, so consider who speaks as well as what is said; know as much as you can about the total context of the speaker's participation in a forum over time, before deciding that you fully comprehend the intention behind those words. If in doubt, ask for clarification before you 'flame'.