Just use:
open INPUT, $Filepath or die "Cannot open $Filepath for read :$!"; 
to read the file
You may want to change the while statement to <INPUT> not <input> I
understand that perl is case-sensitive in a lot of situations.
Matt

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Friday, December 01, 2000 11:15 AM
To: Matthew Thompson
Cc: [EMAIL PROTECTED]
Subject: RE: PERL and Files


Matt,
        I am trying to read from the $Filepath file not write to it.

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]
> Sent: 01 December 2000 11:04
> To: griffiths, gregory d. /here; [EMAIL PROTECTED]
> Subject: RE: PERL and Files
> 
> 
> Gregory use;
> open INPUT, ">$Filepath" or die "Cannot open $Filepath for read :$!";
> to open the file for writing
> Matt
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]
> Sent: Friday, December 01, 2000 11:01 AM
> To: [EMAIL PROTECTED]
> Subject: PERL and Files
> 
> 
> Dear All,
>         I am having a small problem with reading files in PERL, I'm 
> using :
> 
> my $Filepath="navbar.html";
> my $line;
> 
> open (INPUT, "< $Filepath for reading: $!")
>         or die "failed to open Navbar file $Filepath: $!";
> 
> while (<input>)
> 
>         chomp $line;
>         print $line;
> 
> close(INPUT);
> 
> where the specified file is in the same directory as the perl file. 
> everytime I run this I get :
> 
> Failed to open navbar.html no such file or directory
> 
> Apart from the obvious (and in this case misleading - I think) error 
> message what am I doing wrong ? I am only trying to open a HTML file 
> and  read all its contents in and then print it immediately (sort of 
> like an SSI using PERL)  to provide a static navbar with my 
> dynamically 
> generated content. 
> 
> 
> _______________________________________________
> ActivePerl mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/activeperl
> 
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl

Reply via email to