Help for this page

Select Code to Download


  1. or download this
    my $string = "   a b c  "; # note leading/trailing whitespaces
    
    my @array1 = split /\s+/, $string; # returns '', 'a', 'b', 'c' (4 item
    +s)
    my @array2 = split ' ',   $string; # returns     'a', 'b', 'c' (3 item
    +s)