Hi,
I am using a perl script edit certain xml tags. Previously i was picking up the xml files one by one and running the code. But I thought it would be
easy if i can edit all xml files in a single go.
Below is the part of my code
#!/usr/bin/perl
use Getopt::Long;
use XML::Twig;
foreach my $xml(@file)
{
$twig->parsefile_inplace($xml);
}
sub getoption{
GetOptions ("file=s" => \$data,) or die("Error in command line argumen
+ts\n");
@file=glob($data); #globbing to pick '*.xml'
}
The code seems to work. But i would like to know if there is a better way to do and also if there is any pitfall the way i do it now.
Script calls
./script -f config.xml
./script -f '*.xml'