#!/usr/bin/env perl use strict; use warnings; my @files = @ARGV || glob "*.xml" or die "No files specified!"; my %xmlstring = ( Hzbprtype => qr/]*>\s*52\s*<\/kBPrType>/, ); for my $file ( @files ) { my @cont = do { local(*ARGV, $_, $/); @ARGV = $file; $/ = ""; <>; } if ( -r $file ); for ( @cont ) { if ( /$xmlstring{'Hzbprtype'}/gs ) { print "\n$file\nThis is impossible!"; } if ( /$xmlstring{'Hzbprtype'}/gs ) { print "\n$file\nThis is impossible too!"; } if ( /$xmlstring{'Hzbprtype'}/gs ) { print "\n$file\nSo weit so gut..."; } } }