Bill Kelly wrote: >>In article <8x%1d.2604$Qv5.529 / newssvr33.news.prodigy.com>, >>Chris <ceo / nospan.on.net> wrote: >> >>>(4) Each language has it's own strengths. IMO one of Perl's strengths >>>is the simplicity and consistency of it's parameter passing: >>> >>>sub shell { >>> >>> my @output; >>> for (@_) { push @output, `$_` } >>> chomp( @output ); >>> return wantarray ? @output : \@output; >>> >>>} >>> > > In ruby that might be, > > def shell(*args) > args.map {|a| `#{a}`.chomp} > end > > ..It's true you'll always get an array back. But if > you want to splat the array such that you can assign > its individual element(s) to variables you can... > > a = shell("echo 1", "echo 2") # a => ["1", "2"] > a,b = *shell("echo 1", "echo 2") # a => "1", b => "2" > Ew... thanks for writing that. I had not yet gotten to the point of converting my Perl shell() routine to Ruby, but this puts (ha!) me ahead a little bit. I wrote the shell() routine in Perl simply as a reverse example; I wasn't asking how to do it in Ruby. This "puts" you into the bonus round... :-) -ceo