perl -e ' $str = "hi|there"; $d = quotemeta("|"); @a = split /$d/, $str; print +($_,$/) for (@a);' __END__ hi there