Help for this page

Select Code to Download


  1. or download this
    my $string = "This and that";
    print "$_\n" for split /\s+and\s+/, $string;
    __OUTPUT__
    This
    that
    
  2. or download this
    my $string = "This and that";
    print "$_\n" for split /\s+(and)\s+/, $string;
    ...
    This
    and
    that
    
  3. or download this
    my $string = "This and that";
    print "$_\n" for split /(?=\s+and\s+)/, $string;
    __OUTPUT__
    This
     and that
    
  4. 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