in reply to Death of time_t Timer

Change

sub getime() {

to

sub getime {

to lose that particular error. Also note that the month returned is 0..11 -- so you might want to add one to it in getime.

Edit: Forgot to mention: Be sure you know the difference between calling a sub via &getime() and getime(). You might want the latter form. See perlsub for more info.

Replies are listed 'Best First'.
Re: Re: Death of time_t Timer
by OverlordQ (Hermit) on Jun 18, 2003 at 22:34 UTC

    Also note that the month returned is 0..11 -- so you might want to add one to it in getime.

    Doh! :)

    Forgot to mention: Be sure you know the difference between calling a sub via &getime() and getime(). You might want the latter form. See perlsub for more info.

    That has to do with @_ right?

      That has to do with @_ right?

      Partially. See this relevant bit from the perldoc:

      NAME(LIST); # & is optional with parentheses. NAME LIST; # Parentheses optional if predeclared/imported. &NAME(LIST); # Circumvent prototypes. &NAME; # Makes current @_ visible to called subroutine.

      So the passing of @_ is affected, as is the prototyping. I'm not too familiar with prototypes in Perl, so I'm not sure how things are affected when prototypes are circumvented... which is why I pointed to the perldocs instead of spelling it out myself. I know there's a difference, but haven't really looked into it. ;)