my $in = ($scalar =~ /array/i) ? join(",",@$scalar) : $scalar;
Update: It occurs to me that by using a regex there, you are opening yourself up to a bug if $scalar contains the substring "array", so you should probably use the ref operator. And as Mutant points out below, if you are going for prettiness and legibility, an if-else is far clearer in intent than ? will be.
In reply to Re: Joining if an array
by kennethk
in thread Joining if an array
by Rodster001
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |