[oak perl] The mysterious "undef"

Zed Lopez zed.lopez at gmail.com
Mon Mar 21 12:07:08 PST 2005


> I rarely need to use that, but I use it as a placeholder on the left
> hand side (LHS) of assignments from time to time.
> 
>  #$sec, $min,$hour,$mday,$mon,  $year,$wday,$yday,$isdst
>  (undef,$min,$hour,$day, $month,$year,undef,undef,undef) = localtime();

You don't need the ones on the right.

(undef,$min,$hour,$day, $month,$year) = localtime();

will do just fine, as would

($min,$hour,$day, $month,$year) = (localtime)[1..5]


More information about the Oakland mailing list