--- Bryan Harris <[EMAIL PROTECTED]> wrote:
> >> I'd like to concatenate two variables--
> >> $newVar = $old1 . $old2;
> >> -- where $old1 might be undefined. Is there any way to set a flag
> >> so that this just results in $old2 instead of the compiler
throwing
> >> an error?
> >
> > The concatenation operator will work fine with an undefined value.
>
> That's good to know...
>
> It looks like I've over-simplified.
lol -- looks like it! >:O]
> I'm "concatenating" two variables into a list:
>
> $newTxt[$row] = [ @{$numTxt[$row]},
> "\t" x ($nextCol - $#{$numTxt[$row]}),
> @temp ];
Ah, but this isn't a concatentation.
You've made an implicit list out of all the contents of the [], which
then returns a reference to an unnamed array containing copies of all
those values.
> I'd like result to be @temp if $numTxt[$row] is undefined, and that
> whole mess if it isn't. It seems like this should be done without an
> if/then, but I can't see how.
Ok -- much easier to do if you see the problem! :)
$newTxt[$row] = [ ( $numTxt[$row]
? ( @{$numTxt[$row]},
"\t" x ($nextCol - $#{$numTxt[$row]}),
@temp
)
: @temp
) ];
I tried to space that out to make more sense -- sorry if it didn't
work, lol....
You're still doing a test, but it doesn't have to be with if/else
keywords. Is that better?
__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]