[oak perl] The mysterious "undef"

Benjamin Elijah Griffin oaklandpm at eli.users.panix.com
Mon Mar 21 09:57:18 PST 2005


Jon Seidel <jseidel at edpci.com> wrote:
> One of the things that you'll use undef for is to act as a placeholder
> for parameters. As I recall, there are MySql calls that often require
> the use of undef, since you don't want to pass a value for, say,
> parameters 2 and 3, but you have to give a value for parameters #4 and
> 5.
> 
> Thus, you would say something like:
> 
> $mysql->search($db, undef, undef, $text, $results)

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();

Elijah


More information about the Oakland mailing list