title: Printing a text file using perl
body: <p>I am completely new to this and this should be the easiest thing to do but for some reason I cannot get my local text file to print.  After trying multiple times with different code I came to use the following code but it doesn't print.</p>
  
  <p>I have searched for days on various threads to solve this and have had no luck.  Please help.  Here is my code:</p>
  
  <pre><code>#!/usr/bin/perl
  
  $newfile = "file.txt";
  open (FH, $newfile);
  
  while ($file = &lt;FH&gt;) {
           print $file;
  }
  </code></pre>
  
  <p>I updated my code to the following:</p>
  
  <pre><code>#!/user/bin/perl
  
  use strict;            # Always use strict
  use warnings;          # Always use warnings.
  
  open(my $fh, "&lt;", "file.txt") or die "unable to open file.txt: $!";
                     # Above we open file using 3 handle method
                     # or die die with error if unable to open it.
  while (&lt;$fh&gt;) {        # While in the file.
       print $_;     # Print each line
   }
  close $fh;             # Close the file
  
  system('C:\Users\RSS\file.txt');
  </code></pre>
  
  <p>It returns the following: my first report generated by perl. I do not know where this is coming from. Nowhere do I have a print "my first report generated by perl."; statement and it definitely is not in my text file.</p>
  
  <p>My text file is full of various emails, addresses, phone numbers and snippets of emails. </p>
  
  <p>Thank you all for your help. I figured out my problem. I somehow managed to kick myself out of my directory and did not realize it.</p>