March 2014 update
This commit is contained in:
parent
09687c4926
commit
a25938f123
1846 changed files with 21876 additions and 5203 deletions
|
|
@ -1,11 +1,11 @@
|
|||
#!/usr/bin/perl -w
|
||||
use strict ;
|
||||
sub multisplit {
|
||||
my ( $string , $pattern ) = @_ ;
|
||||
split( /($pattern)/, $string, -1 ) ;
|
||||
my ($sep, $string, %opt) = @_ ;
|
||||
$sep = join '|', map quotemeta($_), @$sep;
|
||||
$sep = "($sep)" if $opt{keep_separators};
|
||||
split /$sep/, $string, -1;
|
||||
}
|
||||
|
||||
my $phrase = "a!===b=!=c" ;
|
||||
my $pattern = "==|!=|=" ;
|
||||
print "$_ ," foreach multisplit( $phrase , $pattern ) ;
|
||||
print "\n" ;
|
||||
print "'$_' " for multisplit ['==','!=','='], "a!===b=!=c";
|
||||
print "\n";
|
||||
print "'$_' " for multisplit ['==','!=','='], "a!===b=!=c", keep_separators => 1;
|
||||
print "\n";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue