PERL   74

perl file object

Guest on 12th May 2022 01:31:04 AM

  1. $f = new File("/home/rappleto/junk.txt");       # record the filename
  2. $f.unlink();                                    # destroy the file
  3. $f.create();                                    # create the file
  4. $f.setContent("I love cheese");                 # replace content with this data
  5. die "Bad length " if ($f.length() != 13);       # get file length
  6.  
  7. $text = $f.getfile() # reads the whole file     # read the whole file

Raw Paste


Login or Register to edit or fork this paste. It's free.