title: How can I make Perl print first ten lines of a string?
body: <p>I'm trying to show the first ten lines of a large string (first 10 lines of a paragraph). I've tried to use: </p>
  
  <pre><code> $lines = head-10 $string
  </code></pre>
  
  <p>I saw some examples that use <code>while</code> loops but my script can't facilicate that, I need it to be a variable.</p>
  
  <p>Next I tried to use:</p>
  
  <pre><code> $string = perl -pe'$.&gt;10&amp;&amp;last'
  </code></pre>
  
  <p>which gave me the desired result by typing</p>
  
  <pre><code>String= "$(string | head -n10)"
  </code></pre>