Posted By

micmath on 07/17/06


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

jkochis
mabridge


Read a Whole File


 / Published in: Perl
 

  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  

You need to login to post a comment.