NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Bad analogy.... (Score:1)
I think your complaint boils down to "Ruby doesn't have 'use strict;'", combined with "Ruby can't tell the difference between a local variable and a method call". The perl 5 code that's actually equivalent to the ruby code is
sub y {
if false { $x = 100 }
return $x;
}
-- Note the lack of 'my' in the method; this would 'work' if use strict wasn't in effect, assuming of course that $x didn't exist elsewhere in the program. A call to y would return undef unless the program had assigned
More accurately... (Score:1)
It's not so much "why sigils are great" as "why bizarro heuristics for guessing variable bindings suck." Python's rules for introducing new variable bindings are stupid, but simple. Perl's are explicit and reasonable. Ruby's make me want to strangle kittens.