On Thursday 18 July 2002 04:30 pm, Henry House wrote:
> ...
> I like writing
>
>               'a b c d'.split(/\s/).each do |i|
>                       puts "elem = #{i}"
>               end
>
> than
>
>               foreach my $i (split(/\s/, "a b c d")) {
>                       print "elem = $i\n"
>               }

Actually the Perl version can be a bit more succinct:

  for (split /\s/, "a b c d") {print "elem = $_\n"}

BTW does ruby let you do one-liners as in perl -e?

-- Rod
   http://www.sunsetsystems.com/

_______________________________________________
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech

Reply via email to