- or download this
my $string = "This and that";
print "$_\n" for split /\s+and\s+/, $string;
__OUTPUT__
This
that
- or download this
my $string = "This and that";
print "$_\n" for split /\s+(and)\s+/, $string;
...
This
and
that
- or download this
my $string = "This and that";
print "$_\n" for split /(?=\s+and\s+)/, $string;
__OUTPUT__
This
and that
- or download this
my $string = "This and that and those too";
print "$_\n" for split /(?=\s+and\s+)/, $string;
...
This
and that
and those too