in reply to 3 strings to join

I'm puzzled about the use of "exists" here, and I don't see that anyone caught that. The variable $c always exists, once mentioned in the program.

If you mean non-empty, then this will do:

my @conditions = grep length, $b, $c; $string = $a; $string .= " where ".join(" and ", @conditions) if @conditions;
For non-whitespace, change length to /\S/.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
RE: Re: 3 strings to join
by jptxs (Curate) on Sep 29, 2000 at 05:50 UTC

    another problem of a philosopher in a programmers world...there's no use strict; when interpreting Nietzsche.

    I meant non-empty. : )

    -- I'm a solipsist, and so is everyone else. (think about it)