Leser: 1
4 Einträge, 1 Seite |
1
2
3
4
5
open(DAT, "+>$data_file") || die "[$data_file]$!";
my @inhalt = <DAT>;
#machwas
print DAT @inhalt;
close(DAT);
QuoteYou can put a '+' in front of the '>' or '<' to
indicate that you want both read and write access
to the file; thus '+<' is almost always preferred
for read/write updates--the '+>' mode would clob-
ber the file first.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl
use warnings;
use strict;
my $data_file = "";
my $data_file_tmp = "";
open(DAT, "<$data_file") or die $!;
open(NEU, ">$data_file_tmp") or die $!;
my @inhalt = <DAT>;
print NEU @inhalt;
close(DAT) or die $!;
close(NEU) or die $!;
rename($data_file_tmp, $data_file);
1;
4 Einträge, 1 Seite |