note
elusion
If you want to get the extension, you can do this:<p>
<code>$ext =~ s/^.+(\.\w+)$/$1/;</code><p>
That substitutes the whole string with the last dot and what comes after. What behavior do you want with "foo.tar.gz"? The above regex will replace it with ".gz". If you want ".tar.gz", you should use<p>
<code>$ext =~ s/^.+?(\.[\w\.]+)$/$1/;</code><p>
which searches for as little as possible in front, followed by a dot and one or more alphanumerics or dots. This can cause problems with directories that have dots in them though. If that becomes a problem, you will need to test for "/" in the regex. Hope this helps,<p><b><A HREF="/index.pl?node=elusion&lastnode_id=1072">elusion</a></b> <b>:</b> <b><A HREF="http://matt.diephouse.com">http://matt.diephouse.com</a></b>
203044
203044