I intended to send this to the list and accidentally replied directly to
the person to whom I was replying.  I figure it's worth reposting to the
list.

----- Forwarded message from Chad Perrin <[EMAIL PROTECTED]> -----

From: Chad Perrin <[EMAIL PROTECTED]>
To: Jen Spinney <[EMAIL PROTECTED]>
Subject: Re: Quick question on code factoring

On Mon, Sep 11, 2006 at 08:28:15PM -0400, Jen Spinney wrote:
> 
> Chad -
> 
> Thanks for the quick reply.  How do I embed the "unless" inside
> function call parentheses?
> 
> I've muddled around with the following, but it's not right.  (I'm
> probably embarrassing myself by showing I tried it this way... :) )
> 
> ($x[0], $time1,
> $x[1], $time1,
> $x[2], $time2, unless $color eq $B_COLOR
> $x[3], $time2, unless $color eq $B_COLOR
> ... )

The way you did that makes "unless $color eq $B_COLOR" a separate
element from "$x[2], $time2," (think about the commas).

I recommend using the syntax suggested by John W. Krahn for this.  I
haven't tested it to ensure that it works, but from a cursory glance it
looks like it should work, and it's prettier than what I was thinking.

-- 
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
Brian K. Reid: "In computer science, we stand on each other's feet."

----- End forwarded message -----

-- 
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
"There comes a time in the history of any project when it becomes necessary
to shoot the engineers and begin production." - MacUser, November 1990

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to