Help for this page

Select Code to Download


  1. or download this
    # Get a list of all files in a given directory
    # Note use of the grep to exclude subdirectory names
    ...
    # Strip off any leading folder names so that
    # myfolder/file1.txt then becomes just file1.txt
    s/.*[\\\/]// for @files_in_dir;
    
  2. or download this
    my @matching_files = grep { $wanted{ $_ } } @files_in_dir;