On Thu, Jul 18, 2002 at 04:49:13PM -0700, Rod Roark wrote: > 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"}
True. I consider $_ and friends to be ugliness best avoided, however. Perl can be made plenty succinct, but usually at the cost of readability. To read such perl code you need to keep a lot of syntax rules in your head. Btw, the best place to learn about ruby is www.ruby-lang.org. -- Henry House The attached file is a digital signature. See <http://romana.hajhouse.org/pgp> for information. My OpenPGP key: <http://romana.hajhouse.org/hajhouse.asc>.
msg03189/pgp00000.pgp
Description: PGP signature