in reply to localtime()

It's just trivial, but you can put the my infront of the localtime() line and get rid of the long gheto of declarations at the begining.

Replies are listed 'Best First'.
Re^2: localtime()
by davido (Cardinal) on Jul 17, 2004 at 08:09 UTC

    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.


    Dave