Thread Variablen, Arrays & Hashes...: ... speichern (11 answers)
Opened by Free Faq at 2004-05-09 20:10

pq
 2004-05-10 17:10
#82125 #82125
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
ich finde solche sachen wie YAML oder Storable besser als Data::Dumper:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
# ungetestet
use YAML;
open FH, "datei" or die $!;
my $yaml = do { local $/; <FH> };
close FH;
my $array_ref = Load($yaml);
$array_ref->[$neuer_index] = $neuer_wert;
$yaml = Dump($array_ref);
open FH, ">datei" or die $!;
print FH $yaml;
close FH;
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread Variablen, Arrays & Hashes...: ... speichern