From: David Alan Black Date: 2000-12-02T13:21:03+09:00 Subject: [ruby-talk:6734] Re: perl and ruby Hello -- On Sat, 2 Dec 2000, Joseph McDonald wrote: > A couple of things I noticed which sort of annoyed me: > I had to predeclare the hash and the scaler. x++ didn't > work (which I found out from the FAQ). x = x +1; gave a > syntax error. interpolation with #{var} doesn't seem as > user friendly... Do you mean that this: print "The answer is #{ x + y }.\n" is not as user friendly as this: print "The answer is ", $x + $y, ".\n"; or perhaps this: print "The answer is @{[ $x + $y ]}.\n"; That's the thing: the #{...} syntax allows for arbitrary, dynamically evaluated Ruby code. To do that in a double-quoted string in Perl has always required a bit of a trick. (I imagine this will change in Perl in the future.) > I'm not here to bash ruby, I am just starting to explore it, it looks > like a fun language, I just wanted to point out some things that > a perl person may find annoying in the hopes that perhaps some > of these things can be changed. Do you have Dave and Andy's book? It points out some things that Ruby people find cool, in the hopes that perhaps some of these Perl people can be changed. :-) In fact, I too am a Perl person, in a manner of speaking. For what it's worth, I'd recommend taking Ruby as it comes. There's a ton of relationship to Perl there, obviously, and plenty of room for comparison and feature/syntax debates.... But don't scour Ruby for non-Perlish things. Let the language talk to you. > x += 1 # x++ doesn't work. bummer of the summer. It works on my machine: irb(main):001:0> x = 1 1 irb(main):002:0> x++ 1 2 :-) David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav