in reply to catastrophic near misses in Perl
Now refactor it assub my_function { my $self = shift; my $parm = shift; return $self->{parm}; }
sub my_function { shift->{shift} }
It looks like it should be the same, but the second shift has now become a literal 'shift' and not a shift function. I wouldn't say it fails spectacularly (well I suppose it could depending on the expected results), but it's darn hard to catch by just looking.
|
|---|