Etienne Marcotte schrieb: > > use strict; > > my $fd = "/foo/bar"; > > open (DIR, $fd) or die "Can't open directory: $!"; > readdir(DIR); > close(DIR); > splice(@_,0,2); #remove . and .. > foreach(@_) { > open(FILE, $fd/$_); > while (<FILE>) { > $_ =~ tr/KARMA1N3/N3V3RL4ND/g; # replace all KARMA1N3 with N3V3RL4ND > print FILE $_; > } > close(FILE); > } > > This was untested yet, but I'm pretty sure there is an error in my open
You read and write to the same file at the same time. That has to fail. Better you write to temporary file, and rename it to the origin when you've finished. Best Wishes, Andrea -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]