2013-04-10 21:29:02 -07:00
|
|
|
sub multisplit {
|
2014-04-02 16:56:35 +00:00
|
|
|
my ($sep, $string, %opt) = @_ ;
|
|
|
|
|
$sep = join '|', map quotemeta($_), @$sep;
|
|
|
|
|
$sep = "($sep)" if $opt{keep_separators};
|
|
|
|
|
split /$sep/, $string, -1;
|
2013-04-10 21:29:02 -07:00
|
|
|
}
|
|
|
|
|
|
2014-04-02 16:56:35 +00:00
|
|
|
print "'$_' " for multisplit ['==','!=','='], "a!===b=!=c";
|
|
|
|
|
print "\n";
|
|
|
|
|
print "'$_' " for multisplit ['==','!=','='], "a!===b=!=c", keep_separators => 1;
|
|
|
|
|
print "\n";
|