#!/usr/bin/perl use strict; use warnings; use File::Find; my @files; my $muster = ''; find(\&wanted, "paragraph"); sub wanted { if ( $File::Find::name =~ /$muster/) { print "gefunden .... $File::Find::name \n"; push(@files,$File::Find::name); } return; } foreach my $file (@files) { next if (-d $file); my $newcontent; print "Oeffne File .... $file \n"; open(FILE,"<$file") or die "Cant open $file $! \n"; { local $/; $newcontent = ; $newcontent =~ s!paragraph\{(.*?)\}!$1!sg; } close FILE; open(FH,">$file") or die "cant open $file $! \n"; print FH $newcontent; close(FH); }