Read a Whole File


/ Published in: Perl
Save to your folder(s)



Copy this code and paste it in your HTML
  1. open FILE, '< ./file.txt' or die $!;
  2. flock FILE, 1 or die $!;
  3. my $slurp = do{local $/; <FILE>};
  4. flock FILE, 8;
  5. close(FILE);
  6.  
  7. print $slurp;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.