From: Ben Bleything Date: 2007-08-17T07:46:01+09:00 Subject: Re: backticks On Fri, Aug 17, 2007, John Joyce wrote: > Wow, seems that you can use double-quoted string style substitution > for backtick system calls. > > say we make a list of some files: > ls = Dir.glob('*.doc') > some_file = ls[2] > > on OS X there is the really convenient 'open' tool available at the > command line for example. > `open #{some_file}` > > Whatever application is set to default for opening .doc files will be > called to open the file. > That's not the point as much as system calls via back ticks can be > sent variables and expressions from a Ruby script! > Very convenient! For added fun, try string interpolation inside regular expressions! haystack = "foobarbaz" needle = "bar" haystack =~ /#{needle}/ => 3 yeah :D