Another approach is to use the power of Q... er, quotemeta to unmajick those pesky regex metacharacters.
>perl -wMstrict -le "my $s = '85|mat@com'; print qq{'$s'}; ;; my $sep = '|'; my ($key, $email) = split qq{\Q$sep\E}, $s; ;; print qq{key '$key' email '$email'}; " '85|mat@com' key '85' email 'mat@com'
In reply to Re: What am I doing wrong with 'split'
by AnomalousMonk
in thread What am I doing wrong with 'split'
by flexvault
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |