Thread Datei einlesen -> bearbeiten -> speichern
(9 answers)
Opened by tsy at 2008-08-29 12:49 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 sub process { opendir(DIR, $dir) or die $!; (my $file) = grep { $_ !~ m/^\.{1,2}$/ } readdir(DIR); closedir(DIR) or die $!; my @newFile; open (FILE, "<$file") 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"); foreach my $line (@newFile){ print FILE $line; #print $line; } close FILE; } |