Hi pike,
You could try using the trinary operator...
@d = @a ? @a : @c;
In the example given, if @a returns true (in scalar context ie. has a nonzero length) then it is copied into @d, otherwise the contents of @c are copied into @d.
Update: Arrgh, fglock beat me to it!
"Rule #17 of Travel: Never try and score dope off Hassidic Jews while under the impression that they are Rastafarians."
- Pete McCarthy, McCarthy's Bar
In reply to Re: default values for lists
by Elgon
in thread default values for lists
by pike
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |