#!/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 arguments\n"); @file=glob($data); #globbing to pick '*.xml' }