Help for this page

Select Code to Download


  1. or download this
    $string = "foo bar";
    @match = $string =~ m/(f(oo)) (b(ar))/
    ...
    print "$match[1]\n";    # prints "oo"  (captured by /(oo)/
    print "$match[2]\n";    # prints "bar" (captured by /(b(ar))/
    print "$match[3]\n";    # prints "ar" (captured by  /(ar)/
    
  2. or download this
    use Data::Dumper;
    
    ...
    test1.cpp     0.00% of 21     0.00% of 16
    test2.c     None   16.53% of 484
    test3.h         0.00% of 138    None
    
  3. or download this
    [... snip ...]
    test1.cpp     0.00% of 21     0.00% of 16
    ...
              undef,
              undef
    [... snip ...]
    
  4. or download this
    /(.*\.(?:c|cpp|h))\s+/   # Use (?:...) to create a non-capturing group
    +.
    
  5. or download this
    # I always start my script with these two lines.
    # They prevent you from making various mistakes
    ...
    test1.cpp     0.00% of 21     0.00% of 16
    test2.c     None   16.53% of 484
    test3.h         0.00% of 138    None
    
  6. or download this
    test1.cpp     0.00% of 21     0.00% of 16
    Title:    test1.cpp
    ...
    Title:    test3.h
    Percent2: 0.00% of 138
    Percent3: None