Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Quote and Quote-like Operators

by jeffa (Bishop)
on Jan 15, 2009 at 19:08 UTC ( #736648=note: print w/replies, xml ) Need Help??

in reply to Quote and Quote-like Operators

No. One should choose the delimiters based on what they are wanting to avoid having to escape. If we used them only with {} then we would have to escape {} every time. Best to pick something else:

my $string = q/{(foo => "'bar'")}/;


(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re^2: Quote and Quote-like Operators
by grinder (Bishop) on Jan 16, 2009 at 08:35 UTC

    I used slash (/) delimiters for the longest time in my code, until it dawned on me that using a vi-compatible delimiter pair would allow me to bounce on the % key to go from the beginning to the end. (I believe this is written somewhere in the Perl documentation).

    As a result, qw() has become my preferred idiom, as has qq{}. Looking back at older code these days I find that q/a string/ lacks symmetry, and thus beauty.

    Getting back to the OP, isn't it much better if everyone uses these operators exactly in the way they are described in Perl manuals, I would say yes, that's a sensible default. But one should know when (and why) to break the rules.

    • another intruder with the mooring in the heart of the Perl

Re^2: Quote and Quote-like Operators
by setebos (Beadle) on Jan 15, 2009 at 21:37 UTC
    I see no difference between:
    my $string = q/{(foo => "'bar'")}/;
    my $string = q{{(foo => "'bar'")}};

      That's only true when the curlies are properly nested within the string. Again, it depends. Sometimes the test of the proper nesting is a plus, sometimes it's a bother.

      My syntax highlighter does. Perhaps i did not pick the best example. My point is still valid.


      (the triplet paradiddle with high-hat)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://736648]
[Corion]: marto: Oh, I'm jealous. I'm going to see DM in Frankfurt, but it's a stadium full of people, so, rather a big thing where you mostly get to see the band on screens ;)
[marto]: yes, the last time I saw them was in Berlin a few years ago, at the old Olympic stadium
[marto]: After Sunday I don't think I'll go see them again :)
[LanX]: Corion: come on, people are people! ;)
[Corion]: Naah, I think it's still an OK show so far. Their new songs aren't exactly great, but I'm not going there for new material anyway ;)
[marto]: I got the feeling from the last show that for big sections of it, they were not really into what they were doing
[Corion]: LanX: Sure, they can bask in my Halo
[marto]: more so than the previous show I saw
[Corion]: marto: Well, I think they go a tour every two years and I think it's hard to even get a connection with the crowd at a 20k people concert... But maybe after this time I'll stop too ;)
[Corion]: I still have to see the Pet Shop Boys live before they stop touring at all

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (13)
As of 2017-03-24 11:39 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (301 votes). Check out past polls.