in reply to Loading an array with file names
You could remove the $folder variable and set it to $ARGV1 to allow the second command line variable to be the path of where you are searching.#!/usr/bin/perl $folder = 'C:'; $input = $ARGV[0]; @array = `dir /b ${folder}\\${input}`; foreach (@array) { print "$_"; }
Example script.pl *.txt C: would seach the C:\ directory for anything ending in .txt
|
|---|