in reply to can't call method on an undefined error in perl script

I have one more question Glob function giving only .xml files in current working directory, if I want to get from some other directory folder what can I do.

Write the appropriate glob pattern, see glob / File::Glob

File::Find::Rule is probably easier to use than learning about glob patterns

use File::Find::Rule; my @files = File::Find::Rule->file->maxdepth(1)->name('*.xml')->in( @d +irs );

Or better yet, Path::Class::Rule, its Path::Classy

use Path::Class::Rule; my @files = Path::Class::Rule->new->file->max_depth(1)->name('*.xml') +->all( @dirs );