title: Why isn't my Perl regex matching simple hostnames?
body: <p>I failed extracting a hostname which might be both a FQDN and simple hostname</p>
  
  <p>For example with sed it works fine:</p>
  
  <pre><code>echo test_serv1.TEST-Site-1.test.com|sed 's/\..*//'
  test_serv1
  echo test_serv1|sed 's/\..*//'
  test_serv1
  </code></pre>
  
  <p>But in Perl I get only when its FQDN:</p>
  
  <pre><code>my $t='test_serv1.TEST-Site-1.test.com';
  my ($res) = $t=~ /^(.*?)\./;
  print "$res\n";
  </code></pre>
  
  <p>I tried different combinations for test_serv1, but it does not work, why ?</p>