in reply to Re^2: Determine target file format looking at one link
in thread Determine target file format looking at one link

I don't know if there's a pure perl solution, but you can install the program chase and parse its output in perl. Getting the extension should be a simple matter of regexes or split.