#!/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 "\nThis is impossible!"; } if ( /$xmlstring{'Hzbprtype'}/gs ) { print "\nSo weit so gut..."; } } }