Kevin, 

there is nothing wrong with your code fragments as they are written. 
Barry's comment is not accurate.  The line

    open(FH,"<",$file) 

is the same as 

    open(FH,"<$file)

Your version (the first one) is technically more precise.

the problem could likely be that your path is not being found
correctly. 

if you run the perl program from the same directory in which your file
to be opened is located, it should work with just the filename (full
path not needed).   

if your perl program is run from a different directory than your file
to be opened is located, you will need to enter the entire path.   Do
not use quotation marks in your path and/or file names.

the code i used to verify is this:

   print "enter filename : ";
   
   chomp($file=<STDIN>);
   
   open(FH,"<",$file)
     or die "The file $file could not be found";
    
   print "\ncontents of $file: \n";
   while (<FH>) {
        print $_;
   }
   
   close FH;


--Rob




--- Kevin Wells <[EMAIL PROTECTED]> wrote:

> 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>);
>    
>   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. The file I am trying to use exists currently in the
> directory where the program file exists. I have tried to enter just
> the file name and the whole path including the file name. I get he
> same error either way.
>    
>   Help! I have to have this assignment in tomorrow! Any suggestions
> will be GREATLY appreciated!
> 
>               
> ---------------------------------
> Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  Great
> rates starting at 1ยข/min.>
_______________________________________________
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to