faqts : Computers : Programming : Languages : Perl : Common Problems : File Handling

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

31 of 58 people (53%) answered Yes
Recently 2 of 10 people (20%) answered Yes

Entry

How do I include another file in Perl output?

Mar 26th, 2001 08:24
Allison Smith, Per M Knutsen, agnes rynkiewicz,


This is one way to do it, although I'm sure TMTOWDI:
#!/usr/bin/perl
open (FILE, "include.txt") || die "cannot open file: $!";
  undef $/;           # read in file all at once
  print <FILE>;
close FILE;
Perl Includes,
You can run Unix commands from a perl script, sending a file straight 
to the client of the script:
print `cat signature.file`;
This sends signature.file to the client, remember to use any path that 
may be needed.  Also, notice these are not '', they ARE ``.
allison