in reply to parsing from the right instead of the left

Writing a reverse regex seems like too much work for a lazy Perl hacker. I think you're on the right track, especially with the end-of-line anchor:

(my $ext = $url) =~ m!\.([^/]+)$!;

With greedy quantifiers like + and *, the regex engine parses from right to left anyway. So take advantage of that.

Somehow, that construct isn't behaving for me after a long week, so here's another approach:

#!/usr/bin/perl -w use strict; print "Url: "; chomp(my $url = <STDIN>); if ($url =~ m!\.([^/]+)$!) { print "Ext: $1\n"; } else { print "Not found.\n"; }