I'm not sure what you're trying to accomplish with the regex, but you want to use the ternary operator:
$in = ref( $scalar ) eq "ARRAY" ? join( ",", @$scalar ) : $scalar;
Update: Hot dog ... learn something new everyday. I never knew you could use a regex in place of ref.
In reply to Re: Joining if an array
by derby
in thread Joining if an array
by Rodster001
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |