On Feb 3, 2008, at 6:24 AM, Andy Armstrong wrote:
I should have been more explicit. In Perl 5.10.0 // could be an empty regex or the new 'defined or' operator:
my $foo = $bar // 'not defined'; # new defined-or operator my @f = split //, $baz; # empty regex
The relevant bit from the ruby grammar:
http://pastie.textmate.org/private/zuh0beeg1ciwdqbqlovmaa
Basically we define a list of items a regex can follow, anything else and it's a division operator. What you can do is the same expect only with empty regexes. Match // that follows words that regexes can follow, anything not caught will be caught by the lower // operator match. It's not perfect in Ruby but it's pretty close.