Log in

No account? Create an account

a little ruby/perl note

« previous entry | next entry »
Aug. 9th, 2006 | 10:31 am

I really like the little generic quote markers in ruby and perl, and the camel book makes a nice little chart out of it, but it seems the ruby community has shunned them and it's hard to find documentation for the ruby versions (I don't own the pickaxe, so maybe I'm just missing out). So I've made a little chart for myself, ripped off of the camel book and ruby syntax:

Ruby/Perl Generic Quoting Characters
perlrubycustomarywhat it does
q//%q//''Single quote, quotes a string with no interpolation
qq//%Q// or %//""Double quote, quotes a string with interpolation (although perl and ruby interpolate differently)
qx//%x//``Backticks—execute command
qw//%w//( , ) in perl and [ , ] in rubyQuote words into a list/array
m//%r////Regular Expression
s///String#subs/// (perl only)Substitution
tr///String#try/// (perl only)Translation character by character

| Leave a comment |

Comments {1}

(Deleted comment)

Alex P.

(no subject)

from: wetzel
date: Aug. 9th, 2006 10:49 pm (UTC)

they're optional in ruby too.

Reply | Parent | Thread