Actually, while you're going about the art of fixing unperlish code, how about this?...
my %timehash;
@timehash{ qw/sec min hour mday mon year wday yday isdist/ }
= ( localtime );
Not sure if it's an improvement, but at least you've got just one lexical instead of a whole slew of them.
Of course other more reasonable solutions have already been posted, but I just couldn't bear to see all those scalars being created and used. The hash keeps them all under one roof, so to speak.
|