in reply to Parenthetical help

BTW, all three are wrong as time always returns a scalar so using a list slice on it makes no sense.

Replies are listed 'Best First'.
Re^2: Parenthetical help
by eye (Chaplain) on Apr 04, 2011 at 04:59 UTC
    Good point. The code I posted was oversimplified to isolate the issue. The original code was getting the modify time of a file and looked more like:

    localtime((stat $file)[9])

      The problem is that localtime has a prototype and that prototype says that localtime's first argument, if present, must be a scalar value, so arrays and lists are converted to a scalar value so localtime can use it.

      $ perl -le'print prototype "CORE::localtime"' ;$