Easy-peasey. The perl glob() command is what you're looking for. You'll need to pass the log directory and log prefix to your script instead of a file name and add an outer loop to handle the multiple files. Perhaps something like: