title: How can I implement a timeout for a qx(command)?
body: <p>How could I implement in this piece of code a timeout: if the "hwinfo --usb"-command didn't return anything after a certain amount of time, ( stop the command and ) do a return or die from the sub _usb_device.</p>
  
  <pre><code>#!/usr/bin/env perl
  use warnings; 
  use strict;
  
  
  sub _usb_device {
      my @array;
      {
      local $/ = "";
      @array = qx( hwinfo --usb );
      }
      ...
      ...
  }
  </code></pre>