From: Joseph McDonald Date: 2000-12-02T12:40:01+09:00 Subject: [ruby-talk:6733] perl and ruby I'm a perl guy checking out ruby. I wanted to benchmark a few things that I do a lot of (using hashes, split, etc...). So here is a little snippet: 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... 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. Here are the scripts: print `date`; x = 0; # must initialize... why? h = {}; # again, must initialize... why? for i in 0..10 arr = "hello world hello word".split(/\s/) for b in arr h[b] = b h[b] = h[1] x += 1 # x++ doesn't work. bummer of the summer. # x = x +1; # syntax error... end end print "x: #{x}\n" print `date`; Then in perl: print `date`; for(0..10) { (@arr) = split(/\s/,"hello world hello word"); foreach (@arr) { $h{$_} = $_; $h{$_} = $a{1}; $x++; } } print "x: $x\n"; print `date`; thanks, -joe