Phoenix.pm: odd...

Peter J Jones p at dancris.com
Mon Apr 5 19:37:05 CDT 1999


it allows you to do things like this...

@months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);

$month = $months[(localtime)[4]];

which would set $month to "May"

this also works for weekdays so that you can label months and days easy.

you can also do this...

$m = ('J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D')[(localtime)[4]];

month names are shortened because I am lazy!

you have to put parentheses around the localtime so that you can index it.
In fact, you can index anything that returns an array!

$file_size = (stat("somefile"))[7];


Peter

"Glen G. Walker" wrote:

> I just called localtime (time) and got:
>
>      59 17 15 28 3 99 3 117 0
>
> Does this not read as _March_ 28th instead of April 28th?
>
> UNIX date command yields:
>
>      Wed Apr 28 15:19:43 MST 1999
>
> so, I know the server isn't off...
>
> (I'm looking at page 185 on the Most Holy Camel book...)
>
> -------------------------------------------------------------------------------
> Glen G. Walker,  coyotl at primenet.com
> www.primenet.com/~coyotl
> -------------------------------------------------------------------------------




More information about the Phoenix-pm mailing list