Help for this page

Select Code to Download


  1. or download this
    # Assumes filenames of the form *yyyymmdd.txt
    my $filepattern = sprintf("*%d%d%d.txt", 
    ...
    foreach my $filename (glob($filepattern)) {
        # Process individual files herein
    }
    
  2. or download this
      # Looking, for instance, for "/usr/.*/?bin/perl"
      my $regex = qr{(/usr/.*/?bin/perl)}gs; 
    ...
      printf "Filename: %40s Occurrances: %9d\n", 
        $filename, 
        scalar @matches;