sre> sorry for this question, but i'm not a perl programmer. =\

sre> is there any similar function to php's "include()"?

sre> i want to include an html file into the output the user will get when
sre> opening the .pl


you could use a function something like:

sub echo_file {
  my ($filename) = @_;

  open my $fh, $filename;
  if (!$fh) {
    print "Could not include $filename: $!";
    return;
  }

  # slurp the whole file - don't try this with huge
  # files
  local $/ = undef;
  print <$fh>;
}


this doesn't work like the php include because it won't evaluate any
code that's in the other file, but if all you want to do is cat a file
containing html then this should be okay for you.


-- 
Best regards,
 Daniel


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to