title: Perl: print the line with the largest number from standard input
body: <p>i'm very new to Perl and I've been trying to implement a function that print out the line with the largest number from the standard input. For example, If the input is: </p>
  
  <p>
  Hello, i'm 18
  </p>
  
  <p>
  1 this year is 2019 1
  </p>
  
  <p> 
  1 2 3 - 4
  </p> 
  
  <p>The output should be: 1 this year is 2019 1 </p>
  
  <p>And secondly, I would like to know what does <strong>$line =~ /-?(?:\d+.?\d*|.\d+)/g</strong> mean?</p>
  
  <p>The following is what I've tried, it is not working and I hope someone could fix it for me. I'm struggling with filtering out random characters but leaving out the digit. </p>
  
  <p>
  Is it necessary to push the largest number onto an array? Is there any way that once we could do this in one step?
  </p>
  
  <pre><code>#!/usr/bin/perl -w
  
  while ($lines = &lt;STDIN&gt;){
      @input = $lines =~ /\d+/g;
      if (!@input){
      } else {
          $largest_number = sort {$a &lt;=&gt; $b} @input[0];
          push(@number, $largest_number);
      }
  }
      if (!@number){
      }else{
          print $largest_number;
      }
  </code></pre>