As for the first question (posted over a year ago... whew), this is a pretty easy way to do it:
$file = $filename;
$ext = $filename;
$file =~ s/.+\\(
^\\+)$|.+\/(
^\/+)$/$1/;
$ext =~ s/\.(\w+)$/$1/;
That should give you the file's name in $file and it's extension in, well, $ext. ;)
- Dave Baughman