Slash Boxes
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

use Perl Log In

Log In

[ Create a new account ]

AndyArmstrong (7200)

  (email not shown publicly)
Thursday March 15, 2007
03:35 PM

Misleading idioms

[ #32701 ]

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)?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.