Help for this page

Select Code to Download


  1. or download this
    sub readfile {
      local $/="" unless wantarray;
      return open(FS, shift) ? <FS> : undef;
    }
    
  2. or download this
    defined($slurp = &readfile($file)) or die "Could not open $file: $!\n"
    +;
    print "Scalar 'slurp' now has ", length $slurp, " characters in it\n";
    defined(@slurp = &readfile($file)) or die "Could not open $file: $!\n"
    +;
    print "Array 'slurp' now has ", $#slurp, " elements in it.\n";