
Untitled
By: a guest on
May 3rd, 2012 | syntax:
None | size: 1.26 KB | hits: 26 | expires: Never
Why is Perl saying I only use this once? Why is that even an issue?
use strict;
use warnings;
sub cfgRead () { $main::cfg{"abc"} = "/usr"; }
1;
#!/usr/bin/env perl
use strict;
use warnings;
use 5.005;
require File::Basename;
import File::Basename "dirname";
push (@INC, dirname ($0));
require plugh;
my (%cfg);
sub subOne () {
my $list = `ls -1 $main::cfg{"abc"}`;
my @list = split (/s+/, $list);
my $fspec;
foreach $fspec (@list) {
print $fspec . "n";
}
}
sub mainLine () {
cfgRead();
subOne();
}
mainLine();
Name "main::cfg" used only once: possible typo at /home/xyzzy/bin/xyzzy line 15.
bin
games
include
lib
lib64
local
sbin
share
src
require plugh;
our (%cfg);
sub subOne () {
my $list = `ls -1 $cfg{"abc"}`;
...
}
our(%cfg);
sub cfgRead () { $cfg{"abc"} = "/usr"; }
sub cfgRead {
my %cfg;
$cfg{"abc"} = "/usr";
...
return %cfg;
}
sub subOne {
my $cfg = shift;
my $list = `ls -1 $cfg->{"abc"}`;
....
}
my $cfg = cfgRead();
subOne($cfg);
use warnings;
$something = 1;
$something = $something + 1;
use warnings;
$something = 1;
$something = $somehting + 1;
Name "main::somehting" used only once: possible typo at tmp.pl line 3.