[kw-pm] conditionals and the comma operator

Robert P. J. Day rpjday at crashcourse.ca
Mon Jan 5 04:41:33 PST 2009


  i'm sure i'm about to embarrass myself with how much i've forgotten
my perl, but i'm reading a perl program and, early on, it sets default
command line args thusly:

================================
my ($input,$vm_output,$rfs_output) = @ARGV;

$vm_output = cwd . '/vmlinux',
if (! defined ($vm_output) || $vm_output eq '');
$rfs_output = cwd . '/initramfs.cpio.gz',
if (! defined ($rfs_output) || $rfs_output eq '');
...
================================

  i know what that early processing is meant to do -- assign default
values to $vm_output and $rfs_output unless the user has specified
those values on the command line.  but how is that being done above?

  i vaguely recall that there was a perl idiom that involved the comma
operator to do something like that, but i don't see how that's being
done above.  can someone refresh my memory?  thanks.

rday
--

========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
    Have classroom, will lecture.

http://crashcourse.ca                          Waterloo, Ontario, CANADA
========================================================================


More information about the kw-pm mailing list