You can write the ruby code for hashes a lot more intuitively like so:
#!/usr/bin/ruby # example data hash = { 'a' => '1', 'b' => '2', 'c' => '3', } hash.each do | k, v | puts "#{k} - #{v}<br/>" end
Update for the interested: ruby does have sigils, but they denote "scope" instead of "type": $ - global, @ - instance property and @@ - "static" class property. No sigil basically means lexical scope (automatic variable).
The reasoning behind this probably is, that variables that can be declared "somewhere else" in the code have sigils, but "local" variables don't need sigils since you can see that they are variables because they're declared a close by. In some respects ruby is even more fanatic about saving characters than perl :-) That there is no way to distinguish "type" by sigil is a good thing - since it makes it a lot easier to emulate the built-in types' API with user-defined classes.
In reply to Re: Perl is more intuitive
by Joost
in thread Perl is more intuitive
by kiat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |