RosettaCodeData/Task/Multisplit/Perl/multisplit.pl

12 lines
251 B
Perl

#!/usr/bin/perl -w
use strict ;
sub multisplit {
my ( $string , $pattern ) = @_ ;
split( /($pattern)/, $string, -1 ) ;
}
my $phrase = "a!===b=!=c" ;
my $pattern = "==|!=|=" ;
print "$_ ," foreach multisplit( $phrase , $pattern ) ;
print "\n" ;