my $dir = "/home/limo/Perl/2000/0827/steves/router/configs";#new "yyyy/mmdd" are created daily
"Enter date of config file using < yyyy/mmdd >: "; chomp ( $date_cfg = <STDIN>);# date of file that user wants to process
#code here which grabs the "2000/0827" directories: works fine #code here that converts "2000/0827" to "08/27/2000" via s/// #stores it in "$new_date" for writing to STDOUT: works fine print "Looking for Juniper router configuration file(s) from: $new_date\n";Here's where my problem lies: I need the program to take the previous input from the user in "yyyy/mmdd" format, and plug it into $dir, and list files in the chosen directory.
This bombs: opendir(DIR, $dir/$date_cfg) or die "Can't read from $dir/date_cfg: $!\n"; as well as: opendir(DIR, $dir/$new_date) or die "Can't read from $dir/date_cfg: $!\n";The program lists directory files just fine, if I hard code the path; I'm just having problems passing the correct directory argument to the code.
In reply to Search for file using element of path as file name by Limo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |