Help for this page

Select Code to Download


  1. or download this
    @q = split(/(.*?)/, $p);
    
  2. or download this
    @q = split(//,$p);
    
  3. or download this
    foreach (@q) {
    
  4. or download this
    @q = split (//, $p);
    foreach (@q) {
    ...
    }
    $out = join ("", @q);
    print "out === $out";
    
  5. or download this
    foreach (@q) {
        if ($_ eq $matchchar) {
    ...
            }
        }
    }
    
  6. or download this
    foreach (@q) {
        if ($_ eq $matchchar && ++$count >= $nummatch) {
           $_ = $repchar;
        }
    }
    
  7. or download this
    foreach (@q) {
       $_ = ($_ eq $matchchar && ++$count >= $nummatch)?$repchar:$_;
    }
    
  8. or download this
    @q = map { ($_ eq $matchchar && 
                ++$count >= $nummatch)?$repchar:$_ } @q;
    
  9. or download this
    @q = map { ($_ eq $matchchar && 
                ++$count >= $nummatch)?$repchar:$_ }
         split(//, $p);
    
  10. or download this
    $out = join ("",
               map { ($_ eq $matchchar &&
                      ++$count >= $nummatch)?$repchar:$_ }
                  split (//, $p));