Why do I get the error:#!/usr/bin/perl -w use strict; ## usage information # $0 UPSNAME HOSTNAME DATAPOINT # where DATAPOINT can be any of # utility - the number VAC utility power is providing # loadpct - the percentage of the maximum load # battpct - percent of total battery charge available # runtime - approx. number of minutes of battery life my $lookfor = $ARGV[2]; my @upsinfo = (`/usr/local/bin/upsc $ARGV[0]\@$ARGV[1]`); my ($junk, $utility) = split /\s+/, $upsinfo[10]; my ($kunk, $loadpct) = split /\s+/, $upsinfo[14]; my ($lunk, $battpct) = split /\s+/, $upsinfo[21]; my ($munk, $runtime) = split /\s+/, $upsinfo[23]; if ($lookfor) { print $$lookfor; } else { print "utility is $utility\n"; print "loadpct is $loadpct\n"; print "battpct is $battpct\n"; print "runtime is $runtime\n"; };
In reply to scalar dereferencing by jamgill
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |