Misleading idioms

AndyArmstrong on 2007-03-15T20:35:35

I've just written some code that looked like this (with error checking):

open my $fh, '>', 'somefile.txt'; my $self = { fh => $fh }; # And then later close delete $self->{fh}; I wonder what that looks like to someone who doesn't know Perl. D'you think they might suspect that 'close delete' is an idiom for closing and deleting a file at the same time?

Mostly I'm blissfully aware of how Perl must look to people who aren't familiar with it but that particular line jumped out.

Can anyone else think of actively misleading Perl idioms (as opposed to just bloody hard to understand ones)?