in reply to Opening Text Files
If there are other files in the directory in question that we need to ignore, you'll need a little more:opendir DIR, "/path/to/mlb/incomingdir"; my ($todays_file) = reverse sort readdir(DIR); closedir DIR;
Now you can open $todays_file and process it as you like.opendir DIR, "/path/to/mlb/incomingdir"; my ($todays_file) = reverse sort grep {/mlb_boxscore\$\d{7}\.txt/} readdir(DIR); closedir DIR;
Sorry about the funny formatting of the crucial line to get it to fit here. If you like in your own code you can lay it all down in one line thusly: my ($todays_file) = reverse sort grep {/mlb_boxscore\$\d{7}\.txt/} readdir(DIR);
|
|---|