Thread Textdatei auslesen und Ergebnis in Tabelle speichern
(15 answers)
Opened by hilmix at 2010-09-01 15:37
also ein erster ansatz wäre:
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 open my $fh, "<", "adressen.txt" or die $!; local $/ = "jetzt eintragen!\n"; # als paragraphentrenner betrachten chomp(my @p = <$fh>); for my $paragraph (@p) { my (undef, $name, $address) = split /\n/, $paragraph; my ($street, $city, $phone) = split / (?=\d{5} |\(\d{3,5}\) )/, $address, 3; print "$name | $street | $city | $phone\n" } 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: Wie frage ich & perlintro brian's Leitfaden für jedes Perl-Problem |