I have some Perl code which has file glob operation.
$file1 = @ARGV[0];
@res1 = glob "$file1*";
I want the whole absolute paths to be reflected when i glob the files, not just the file names which is the case currently in my code.
e.g. when I do glob "*.pdf" i need the absolute paths of the pdf files to be matched and returned to my array variable by glob.
I tried using module use File::Basename; but that seems to be used for parsing a file path into directory, file name , suffix.
How do I get this effect.
thanks,
-AD.
You want to use the core module Cwd
to get the full path with respect to your current working directory.
use Cwd;
@res1 = map { Cwd::abs_path($_) } glob "$file1*";