Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
    my @pieces = $to_split =~ /('\w'(?:,'\w'){0,4})/g;
    $"="\n";
    print "@pieces\n";
    
  2. or download this
    use strict;
    use warnings;
    ...
    my @pieces = grep {$_} split /('\w'(?:,'\w'){0,4}),?/, $to_split;
    $"="\n";
    print "@pieces\n";