title: How to Display IFconfig information with perl program in Linux
body: <p>I have an assignment where i am supposed to create a perl script in linux that will give an output similar to that of the linux command "ifconfig". I have started writing the script but I repeatedly get errors. I would like some assistance in correcting my code so it becomes fully operational. What the program needs to do specificaly is require a perimeter. for example when i run the script it will ask for an interface name, if I typed in "eth0" which will be the interface name, and then it should output as if i typed in the command “ifconfig eth0”. The assignment requires that I use these two packages Net::Int::Stats and Net::Ifconfig::Wrapper.
  The code i have so far is below. I would really appreciate any help</p>
  
  <pre><code> #!/usr/bin/perl
  use strict;
  use warnings;
  use Net::Int::Stats;
  use Net::Ifconfig::Wrapper;
  
  my $int            = 'eth0';
  my $stat           = 'rx_packets';
  my $Iface          = $ARGV[0];
  my $get_Iface_data = Net::Int::Stats-&gt;new();
  my $Iface_Info     = Net::Ifconfig::Wrapper::Ifconfig('list', '', '', '');
  
  my $rx_packets  = $get_Iface_data-&gt;value($Iface, 'rx_packets');
  while( my ( $Addr, $Mask ) = each %{ $Info-&gt;{$int}{'inet'} } ) { 
      print "\tinet $Mask $Addr"; 
  }
  </code></pre>