Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Include file within script

Expand Messages
  • Charles K. Clarkson
    Malai ... my $file_name = /top.txt ; open FH, $file_name or die $file_name: $! ; while ( ) { print; } close FH; The while block
    Message 1 of 1 , Jan 1, 2002
    • 0 Attachment
      Malai <malaikat@...>

      : Hi,
      :
      : How to include a file within script?
      :
      : Say I have a file called "top.txt" in the root dir, and I want
      : the perl script to display the pure texts contents of the file
      : using print at the display when the script executed.

      my $file_name = '/top.txt';
      open FH, $file_name or die "$file_name: $!";
      while ( <FH> ) {
      print;
      }
      close FH;

      The 'while' block can be shortened to:

      print while <FH>;


      HTH,
      Charles K. Clarkson
      Clarkson Energy Homes, Inc.
      254 968-8328


      The world is full of willing people. Some willing to work, the rest willing to
      let them.
      - Robert Frost
    Your message has been successfully submitted and would be delivered to recipients shortly.