in reply to Re^2: Style Question: Throwaway Objects
in thread Style Question: Throwaway Objects

Just to nitpick: you're leaving a lexical $parser around that the condensed form doesn't

Well, yes. But compared to turning a very readable

my $parser = Spreadsheet::ParseExcel->new() my $book = $parser->Parse($filename);
into a double-take inducing   my $book = do { Spreadsheet::ParseExcel->new() }->Parse($filename); leaving a lexical around is a minor sin. When I have to choose between various sins, I'll go with the one that's readable.

Replies are listed 'Best First'.
Re^4: Style Question: Throwaway Objects
by Aristotle (Chancellor) on Dec 09, 2002 at 09:06 UTC
    That was just the last in a series of transformations showing the equivalence of the samples - I'd probably pick the first one:
    my $book; { my $parser = Spreadsheet::ParseExcel->new(); $book = $parser->Parse($filename); }

    Makeshifts last the longest.