title: Perl checking if network interface is up (linux)
body: <p>everyone, I am currently working on a script in perl to check if certain interface is up.</p>
  
  <p>I have tried different methods in linux I tried reading /proc/net/dev which did work but in my if statement I had it compare against eth1 and it always said eth1 was up even though it was not in /proc/net/dev the interface will only be in there is it was up (I have a usb ethernet adapter and wasn't even plugged in)</p>
  
  <p>At the moment I went the cheap route.</p>
  
  <pre><code>#!/usr/bin/perl
  
  $cheapway = `ifconfig eth1`;
  
  if($cheapway){
     print "$cheapway";
  }
  
  else {
     print "eth1 is down";
  }
  </code></pre>
  
  <p>I mean this works, but it feels like bad programming practice.
  Thanks in advance</p>