in reply to how can i send data to /dev/null ?
Well, you can go through the explicit process of opening /dev/null and writing your data to it, but effectively you'd be doing the same thing, your data doesn't get written anywhere. This seems pretty senseless to me though, what are you trying to do? Delete a file? In that case look at perldoc -f unlink. If you're trying to empty a file, open that file for writing and then close it again
open(my $null, ">","path/to/file") or die "Can't open file for writing +"; close $null or die "Can't close open filehandle";
, but you have to be sure noone is going to try to write to the file while you're doing that, otherwise the outcome may not be what you want. For anything more complicated Tie::File may come in handy.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how can i send data to /dev/null ?
by xdg (Monsignor) on Dec 11, 2005 at 13:44 UTC | |
|
Re^2: how can i send data to /dev/null ?
by jcc (Sexton) on Dec 12, 2005 at 16:37 UTC | |
by tirwhan (Abbot) on Dec 12, 2005 at 16:57 UTC |