[kw-pm] conditionals and the comma operator

Fulko Hew fulko.hew at gmail.com
Mon Jan 5 05:04:28 PST 2009


On Mon, Jan 5, 2009 at 7:41 AM, Robert P. J. Day <rpjday at crashcourse.ca> wrote:
>
>  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.

I can't help on your comma question, but I'd say in the above case...
that the comma is irrelevant
.


More information about the kw-pm mailing list