Help for this page

Select Code to Download


  1. or download this
    my $string = "1:1,2:1,3:2,500:2,505:1";
    my %hash = split /[:,]/, $string;
    my @array = split /:.+?,?/, $string;          #  :-)
    
  2. or download this
    my $string = "1:1,2:1,3:2,500:2,505:1";
    my %hash = my @array = split /[:,]/, $string;
    @array = @array[grep $_%2==0, 0..$#array];