An array might be mixed, containing both objects and strings (or other scalar values). Also, some might be references to unblessed data structures.
If the strings you want to construct from objects can be obtained by overloading double-quotes, then you don't need to test; just say,
If overloading quotes is not feasable, you can say,sub foo { my @stringy_args = map { "$_" } @{shift()}; # . . . }
That lumps blessed objects with other references, and numbers with strings. For finer discrimination, Scalar::Util has a bunch of functions like blessed and looks_like_number to help out.sub foo { my @stringy_args = map { ref ? bestring($_) : "$_" } @{shift()}; # . . . }
After Compline,
Zaxo
In reply to Re: Distinguishing between an array of objects and an array of strings
by Zaxo
in thread Distinguishing between an array of objects and an array of strings
by loris
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |