in reply to Script is unable to open file

While embedded spaces in your filenames are acceptable, you cannot normally have a colon in your filename in Windows. There used to be shennanigans you could use to force them in, but normal usage of opendoes not include this.

You can fabricate a slightly cleaner filename:

my $logFile = "C:\\Test\\Data\\Mytime1:00:34 AM"; my ($logDrive, $logFilebase) = split /\:/, $logFile, 2; $logFilebase =~ s/[\:\>\<\|\s]+/\_/g; my $cleanLogFile = "$logDrive\:$logFilebase"; print " \$logFile: [$logFile]\n"; print "\$cleanLogFile: [$cleanLogFile]\n";

Results:

D:\PerlMonks>\steve\t\t22.pl $logFile: [C:\Test\Data\Mytime1:00:34 AM] $cleanLogFile: [C:\Test\Data\Mytime1_00_34_AM]

Update: Definite ++to 1nickt for the use of standard module for date/time consistency, as well as the universal format. You'll still need to filter out or convert the colons.