in reply to Re^2: Deleting on Files
in thread Deleting on Files

Could I do something like this:

#!/usr/bin/perl use strict; use warnings; open (FILE, '+<', 'sample.txt') or die "Could not open sample.txt: + $!"; close (FILE) or die "Could not close sample.txt: $!";

Replies are listed 'Best First'.
Re^4: Deleting on Files
by eric256 (Parson) on Feb 28, 2007 at 17:13 UTC

    Using > instead of < will open it for writing and truncate the file.

    open (FILE, '>', 'sample.txt') or die "Could not open sample.txt: $!"; close (FILE) or die "Could not close sample.txt: $!";


    ___________
    Eric Hodges