On Sun, 9 Feb 2003 11:45:56 -0600, [EMAIL PROTECTED] (Ktb) wrote:

>Is there any function that places perl code from a file into a program
>as if it was just part of the program file itself?
>
>Something like:
>
>file
>**************
>Hello World.
>**************
>
>program
>$file = slurp('file');
>print "$file\n":

Well the advice given by others is correct, but just to
answer the "slurp" part of your question.

#Return the file contents as a scalar value 
sub slurp {
  my $OP ;
  open FS, $_[0] or die "Can't open $_[0]:$!";
     {local $/ = undef; #file as 1 big string instead of line by line 
      $OP = <FS>;
      }
   close FS or die "Can't close $_[0]:$!";
return $OP ;
}






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

Reply via email to