Checking what the file extension is in a perl script.
Posted on 2006-04-11
I am writing a perl script and within it I have a variable with a path and file name in it. For example:
$MY_PATHNAME = /myprogs/abc.xml
However, when this perl script executes sometimes the (.xml) extension will be different. Say something like, (acb.txt).
How can I write an "if" statement in perl that only compares the extension.....nothing preceding it (pathname and filename).
if ($MY_PATHNAME eq "*.xml")
BTW, the above won't work, but just wanted to give you an idea of what I am doing.