Kevin Struckhoff wrote:
> Using Perl 5.6.1 on HP-UX.
>
> I need to test for the existence of a file every day. The filename
> changes each day because the filename contains a data and time stamp.
> For example, today's filename is KeyLinks_082903_120712.csv. So I
> would like to test for KeyLinks*.csv
>
> My code is as follows:
>
> -----
>
> $file = "$DATA_HOME/KeyLinks\*.csv";
This will expand the $DATA_HOME, but I don't believe it do anything else.
I would use either glob or readdir looking for the date, like
if ( $file =~ /$MyDate/ ) {
# $MyDate would would be setup in the format you have of mmddyy
# you now have the file and can do what you want
}else {
# file does not exist yet, so do what you need here
}
> print $file;
> print "\n";
>
> if (-e $file) {
> print "File Keylinks*.csv exists!\n";
> } else {
> print "File Keylinks*.csv not understood!\n";
> }
>
> For output, I get:
>
> ---
> /warehouse/data/KeyLinks*.csv
> File Keylinks.csv not understood!
> ----
>
> It expands the filename and prints it out just fine, but the -e test
It expands the one variable, but the filename is NOT KeyLinks*.csv, but
KeyLins_mmddyy_....
Wags ;)
> fails. Why is that? I have reviewed several reference books and they
> all show examples of using the -e test. It mustn't be evaluating the
> splat correctly.
>
> Thanks,
>
> Kevin Struckhoff
> Data Warehouse Consultant
> Yamaha Motors U.S.
> [EMAIL PROTECTED]
> 714-761-7310
**********************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
****************************************************************
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]