title: Nested subroutines and Scoping in Perl
body: <p>I'm writing Perl for quite some time now and always discovering new things, and I just ran into something interesting that I don't have the explanation to it, nor found it over the web.</p>
  
  <pre><code>sub a {
     sub b {
       print "In B\n";
     }
  }
  b();
  </code></pre>
  
  <p>how come I can call <code>b()</code> from outside its scope and it works?</p>
  
  <p>I know its a bad practice to do it, and I dont do it, I use closured and such for these cases, but just saw that.</p>