#!/usr/bin/perl

@upsoutput=`/usr/local/apcupsd/sbin/apcaccess`;

foreach(@upsoutput) {
  chomp();
  split();
  if ( $_[0] eq 'BCHARGE' ) {
        $bcharge = $_[2];
  }
  if ( $_[0] eq 'TIMELEFT' ) {
        $timeleft = $_[2];
  }
  if ( $_[0] eq 'NOMBATTV' ) {
    	$nombattv = $_[2];
  }
}
print "$bcharge $timeleft $nombattv\n"; 
