#!/usr/bin/perl use warnings; use strict; use Fcntl ':flock'; my $path = 'c:/perl/dvd_files/'; # only doing the problem files - those with unchanged names my @files = glob "$path*.txt"; for (@files) { local $/; open my $fh, '+<', $_ or warn($!), next; flock $fh, LOCK_EX; binmode $fh; my $text = <$fh>; #### $text =~ tr/0-9{}//d; seek $fh, 0, 0; truncate $fh, 0; print $fh $text; }