My background is *nix, specifically SunOS/Solaris, and I had been quite happy using normal quoted strings for years. Then I installed Active Perl on a PC at home but really struggled to write one-liners because of the quoting conventions on MS Windows. When I found out about q{...} and qq{...} and applied them in one-liners they made life easy again. I have now got into the habit of using them all the time so that I don't have to make adjustments when I move between systems.
That's the only reason really. They involve a little more typing and they are not as familiar to most as quoted strings but, for me, they are more convenient.
Cheers, JohnGG | [reply] [d/l] [select] |
i do this too a lot. i just feel it's superior. for one, you so often need to use " or ' in your strings, and you're free to this way, your trade is that you can't use unbalanced forms of your quote marker (so, if you use [ as in qq[] you can't write qq[ :[ = sad face ], that's a syntax error), but in the rare case you must use unbalanced brackets in a in a string, it's probably only of one kind, so just qq with another. there's something good about forcing balance too, i'd use balanced double quotes if we had them (on the same level of accessibility)
another argument is if you want to change your double or single quote status for some reason you just have to change the "front" of the string, usually easier to find, and obviously, also half as much to search for.
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, Express yourself
| [reply] [d/l] [select] |