title: advanced perl syntax - Mojo::DOM
body: <p>I am trying to understand some advanced (for me) perl syntax for html parsing using DOM following <a href="http://blogs.perl.org/users/joel_berger/2012/05/using-mojodom.html" rel="nofollow">this tutorial</a>: </p>
  
  <pre><code>say "div days:";
  say $_-&gt;text for $dom-&gt;find('div.days')-&gt;each;
  
  say "\nspan hours:";
  say $_-&gt;text for $dom-&gt;find('span.hours')-&gt;each;
  </code></pre>
  
  <p>What does this syntax mean? What kind of loop is this? Classic for construction looks like this: <code>for(i=0;i&lt;10;i++){ code }</code> not: <code>{code} for (some_condition)</code></p>
  
  <p>Also what does "each" keyword mean in this context? Does it have something common with the <a href="http://perldoc.perl.org/functions/each.html" rel="nofollow"><code>each</code> Perl builtin function</a> or it is specific to Mojo::DOM? I think if <code>each</code> is under Mojo::Dom it should be mentioned on the Mojo::DOM homepage. But I did not found any mention of <code>each</code> under the <a href="http://search.cpan.org/~sri/Mojolicious-3.44/lib/Mojo/DOM.pm" rel="nofollow">methods section of their site</a>, so it must be a builtin function of Perl. But, this builtin <code>each</code> function has a completely different syntax -- how is this possible?</p>
  
  <p>Another example from tutorial page</p>
  
  <pre><code>say "Open Times:";
  say for $dom-&gt;find('div.openTime')
              -&gt;map(sub{$_-&gt;children-&gt;each})
              -&gt;map(sub{$_-&gt;text})
              -&gt;each;
  </code></pre>
  
  <p>Same issue as above for <a href="http://perldoc.perl.org/functions/map.html" rel="nofollow"><code>map</code></a> and <a href="http://perldoc.perl.org/functions/sub.html" rel="nofollow"><code>sub</code></a> methods.</p>
  
  <ul>
  <li>Can those pieces of "Perlish" code rewritten in a more "C style" manner so I can understand it?</li>
  <li>Most importantly: How to list all methods their parameters and return values contained in Mojo::DOM? It must be done somehow, because I read that even for Perl there are IDEs with intellisense (autocompletion) so this IDE must know the methods return value types etc.</li>
  </ul>