Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

opening ascii files

Status
Not open for further replies.

mellenburg

Programmer
Aug 27, 2001
77
US
I have a header file that I read in that is located in my /cgi-bin directory. I have an identical file in my /httpdocs directory that is read as a server side include by the non-cgi web pages. These 2 directories are in the same root directory. Is it possible to open the file in the /httpdocs directory in a PERL script so I don't have to make modifications to both files?

I've tried using the full system path and it hasn't worked.
 
If you have permission to open the file in the httdocs directory it should be no problem.
@paths = ('first/path/','second/path');

foreach $path (@paths_{
open (TXTFILE, ">path/file.txt");
@lines = <TXTFILE>;


print @lines; #or manipulate it


print TXTFILE @lines;
close(TXTFILE);

This is a simple solution.



There is also a PERL module for handling this called Text::Repository I beleive.

haunter@battlestrata.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top