I'm writing a script that looks for certain files in a directory and processes them. I keep on writing the following:
opendir DIR, $dir;
@files = readdir DIR;
closedir DIR;
While I could (and in fact should) wrap this in a function, I was wondering if there's a more elegant way to do this?