$\ = "\n"; $, = ";"; for my $sep ('\t', "\t") { print split(/\Q$sep/, "foo\tbar\\tbaz"); }