...we can provide a list too in split function.
Sorry, no. split operates on a single string (a scalar), but not on a list:
13:57 >perl -wE " $s = q[abc]; $t = q[mno]; say for split(//, $s, $t); + " Argument "mno" isn't numeric in split at -e line 1. a b c 14:06 >perl -wE " $s = q[abc]; $t = q[mno]; say for split(//, ($s, $t) +); " Useless use of a variable in void context at -e line 1. m n o 14:06 >perl -wE " @u = (q[abc], q[mno]); say for split(//, @u); " 2 14:06 >
The docs however mention EXPR ... which I assumed to be a scalar.
Yes, your original assumption was correct. But split returns a list, which is why the output of split can be the subject of a foreach or a map.
Hope that helps,
Athanasius <°(((>< contra mundum
In reply to Re^3: Multiple foreach loops in single statement
by Athanasius
in thread Multiple foreach loops in single statement
by gurpreetsingh13
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |