my @delim = qw(: :: / / \| \|\| \s+); mySplit \@delim, $str1; mySplit [ @delim[0..2] ], $str2;