Fritz Heinrichmeyer <fritz.heinrichmeyer / fernuni-hagen.de> writes:

> Btw. i really would love to use ruby instead of %$<>->@{$\perl} for my web
> and database management scripts, the only thing that makes me nervous is
> the possibility of introducing subtile bugs with block variables ....

My suggestion would be to try it.

I've written many thousands of lines of Ruby code. I think I've
clobbered a variable once, and it was so blindingly obvious when I ran 
the code that it got fixed within 10 seconds.

Part of the reason that it's safe is that Ruby encourages the "code a
little, test a little" way of developing. Its lack of strong typing
means that you really can test programs as you write them, often a
line or so at a time. There's no need to construct great piles of
scaffolding just to be able to test.

There _is_ a different style to writing Ruby, and it takes a while to
learn. Initially, you'll find yourself writing Perl, or Java, or
whatever, but using Ruby syntax. That works fine, but you aren't
really exploiting Ruby. After a couple of days, though, your brain
just kind of clicks to the possibilities, and you find yourself
writing Ruby in Ruby. At that point, issues such as variable scoping
just fade away: it's part of the language, just as local vs. my is
part of Perl, and the scope rules from anonymous inner classes are
part of Java. When you get to that point with Ruby, I pretty much
guarantee that working in other languages is going to start feeling
painful.

Enjoy.


Dave