You might have not recognized the significance of \Q in return (split /\Q$sep/, $source)[ $field-1 ]); The \Q says to ignore any characters in $sep that would otherwise mean something to the regex engine. I often use a \Q...\E pair for this just to highlight this situation. Anyway without \Q, if $sep contains something that matters to the regex engine, you will get confusing results.
In reply to Re^3: nth field extraction
by Marshall
in thread nth field extraction
by lee_crites
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |