in reply to Perl oddities
I think the filehandle functions are generally messy: Bareword file handles, indirect object syntax for print() and close(), open() modifies it's $fh argument, and my least favorite "feature": defaulting to ignoring errors, which just means you end up having to type open FH,"<","file" or die "Can't open file: $!"; every time you use open, print and close.
I would prefer something like this:
my $fh = open "<","filename"; $fh->print "stuff"; $fh->close;
Which would also make it easier to replace a filehandle with some other object.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Perl oddities
by TimToady (Parson) on Mar 01, 2005 at 18:27 UTC | |
Re^2: Perl oddities
by Corion (Patriarch) on Mar 01, 2005 at 11:35 UTC | |
by TimToady (Parson) on Mar 01, 2005 at 18:34 UTC | |
by Joost (Canon) on Mar 01, 2005 at 13:14 UTC | |
by SolidState (Scribe) on Mar 04, 2005 at 22:26 UTC |
In Section
Meditations