Limo has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(Ovid) Re: Search for file using element of path as file name
by Ovid (Cardinal) on Aug 27, 2000 at 07:47 UTC | |
|
Re: Search for file using element of path as file name
by tye (Sage) on Aug 27, 2000 at 09:02 UTC | |
by Limo (Scribe) on Aug 28, 2000 at 04:53 UTC | |
by tye (Sage) on Aug 28, 2000 at 07:13 UTC | |
by Limo (Scribe) on Aug 28, 2000 at 07:34 UTC |