title: Perl s/../../ not working as expected
body: <p>The code is a bit convoluted, but I simplified it a bit. I know I could easily do this:</p>
  
  <pre><code>$svn_module s#.*/##;
  </code></pre>
  
  <p>And pull off just the end of the module. But something strange is going on here:</p>
  
  <pre><code>#! /usr/bin/env perl
  use strict;
  use warnings;
  
  my $svn_module = "http://svn.vegicorp.net/svn/trunk/SessionController";
  print qq(DEBUG: svn_module = "$svn_module"\n);
  $svn_module =~ s#^.*(branches/.+?/)|(trunk)/##;
  print qq(DEBUG: svn_module = "$svn_module"\n);
  </code></pre>
  
  <p>This prints:</p>
  
  <pre><code>DEBUG: svn_module = "http://svn.vegicorp.net/svn/trunk/SessionController"
  DEBUG: svn_module = "http://svn.vegicorp.net/svn/SessionController"
  </code></pre>
  
  <p>However, I was expecting:</p>
  
  <pre><code>DEBUG: svn_module = "http://svn.vegicorp.net/svn/trunk/SessionController"
  DEBUG: svn_module = "SessionController"
  </code></pre>
  
  <p>Why does my substitution expression remove <code>trunk/</code>, but not the rest of the string up to <code>trunk/</code>?</p>
  
  <p>By the way, adding an extra set of parentheses helps:</p>
  
  <pre><code>$svn_module =~ s#^.*((branches/.+?/)|(trunk))/##;
  </code></pre>
  
  <p>will work.</p>
  
  <p>By the way, this is Perl 5.8.8. This is a server, and pretty much the version I'm stuck on.</p>