in reply to getting system time

Doctor Doctor it hurts when I do this, what should I do?

Don’t do it if it hurts

Replies are listed 'Best First'.
Re^2: getting system time
by akrrs7 (Acolyte) on Dec 02, 2011 at 16:16 UTC
    I need to use
    use Time::localtime;
    because later in the script, I am using
    $dateModified = ctime($attrs->mtime);
    to get the timestamp of a file.

    And if don't have the 'use Time' defined, then I get a 'Undefined subroutine &main::ctime called' error

    So not just a question of If it hurts don't do it

      Try not importing stuff from the module, i.e.

      use Time::localtime (); # note the parentheses

      and then call the function fully qualified

      $dateModified = Time::localtime::ctime($attrs->mtime);

      (Or import only ctime, which should not clash.)