----- Original Message ----- 
From: "Kevin Wells" <[EMAIL PROTECTED]>
To: <perl-win32-users@listserv.ActiveState.com>
Sent: Monday, September 18, 2006 7:38 PM
Subject: Opening Files


> I am attempting to open a file using the following command:
>
>   open(FH,"<",$file)
>   or die "The file $file could not be found";
>
>   I get the file path using the following command:
>
>   chomp($file=<STDIN>);

Unless that line of code comes *after* the first section of code you quoted,
I can't see why that would fail.
>
>   When I execute the program after entering the file name from the
keyboard I get an error message that indicates that the file can not be
found.

Hang on .... you're supposed to execute the program , *then* enter the
filename. Run this (untested) code and you'll see what I mean:

use warnings;
print "Enter the filename now: ";
chomp($file=<STDIN>);
 open(FH,"<",$file)
   or die "The file $file could not be found: $!";

> The file I am trying to use exists currently in the directory where the
program file exists.

Just entering the filename should be sufficient. No need to specify the full
path.
The error message should tell you what the name (ie $file) of the file was
that couldn't be found. What is the filename it quotes ? Is it the same as
the filename you entered ? (It should be.)

Cheers,
Rob

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to