Thread Datei einlesen -> bearbeiten -> speichern
(9 answers)
Opened by tsy at 2008-08-29 12:49 renee+2008-08-29 11:21:35-- Wollte nur zeigen wie er . und .. umgeht... So wuerds funktionieren... Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 sub process { opendir(DIR, $dir) or die $!; my @file = grep { $_ !~ m/^\.{1,2}$/ } readdir(DIR); closedir(DIR); my @newFile; for (my $i = 0; $i <= $#file; $i++) { open (FILE, "<$file[$i]") or die $!; while (my $line = <FILE>){ if ( $line =~ s/(print)\s*("\w+")/\$lang->$1($2, \$actUser->{'lang'})/g ){ print "\nFound: $1, $2\n"; } push @newFile, $line; } close FILE; open (FILE, ">$file[$i]"); foreach my $line (@newFile){ print FILE $line; #print $line; } close FILE; } } |