N
Nate Murray
Question, I've been using Ruby for a while now and I have a perlism I
kind of miss.
Given
$str = "foo123";
my ($foo,$bar) = $str =~ /(\w+)(\d+)/;
# now we have
$foo; #=> "foo"
$bar; #=> "123"
I know that I can do this in Ruby in TWO lines, but I want to do it in
ONE line. Anyone have any ideas?
kind of miss.
Given
$str = "foo123";
my ($foo,$bar) = $str =~ /(\w+)(\d+)/;
# now we have
$foo; #=> "foo"
$bar; #=> "123"
I know that I can do this in Ruby in TWO lines, but I want to do it in
ONE line. Anyone have any ideas?