title: Reverse regular expression search
body: <p>I have a string which contains "foo"s followed by numbers. I'm looking to print the number following the last foo in the string. I've been told that the only way to accomplish this is to reverse the string itself. This isn't very elegant, and I'm surprised Perl doesn't have a better way to get the job done. Is there a better way to do it than this?</p>
  
  <pre><code>#!/usr/bin/perl
  # works, but is ugly!!!
  $string = "foo1 foo3 foo5 bar foo911 baz";
  $string = scalar reverse($string);
  $string =~ m/(\d+)oof/;
  print scalar reverse("$1");
  </code></pre>