From: michael libby Date: 2002-10-22T20:04:40+09:00 Subject: Re: Sort::Versions (was Re: Perl multiple match RE in Ruby?) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 22 October 2002 04:36, Simon Cozens wrote: > michael libby writes: > > On Monday 21 October 2002 22:52, WATANABE Hirofumi wrote: > > > How about String#scan ? > > > > That did the trick! This is why I love Ruby, so easy to get stuff > > done. The Ruby version is SO much more readable than the Perl too. > > While I agree, to be fair to Perl, String#scan *in this instance* is > equivalent to String#split, which is Perl's split. > > Of course, String#scan *does* do things that Perl's split can't do, but > what you're doing isn't one of them. :) I was all set to refute this. Then I read 'perldoc -f split' and discovered that in Perl's split() if /EXPR/ contains capturing parentheses it will return the match as well as splitting on it. It works this way in Ruby, too. Thanks for pointing this out. -michael Michael C. Libby x@ichimunki.com http://www.ichimunki.com/ http://www.ichimunki.com/public_key.txt -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9tTCS4ClW9KMwqnMRApxKAJ459Xog+vh2MHmDpdGDnFdEXaUzOgCgtAy9 fWQM940x9PW1PMiKeWrMXUk= =mqjq -----END PGP SIGNATURE-----