Hi,
I have a script, which suppose to find all *.xml files under the specified
directory then process them.
I'm facing the pattern match problem:
use strict;
use warnings;
use Win32;
use File::Find;
@ARGV = Win32::GetCwd() unless @ARGV;
my @dirs;
find (\&FindXml, $ARGV[0]);
sub FindXml
{
return if !stat || -d;
( my $xml_file = $File::Find::name ) =~ /^.+\.xml$/;
push ( @dirs, $xml_file );
}
In this examples the pattern match /^.+\.xml$/ is not working and all files
regardless of the extension have been assigned to $xml_file variable.
#################
However, if I change parenthesis to count the matching, the pattern seems to
work.
sub FindXml
{
return if !stat || -d;
my $xml_file = ( $File::Find::name =~ /^.+\.xml$/ );
print $xml_file;
}
I'll be really grateful for any help here.
Thanks in advance,
Vladimir