stibba has asked for the wisdom of the Perl Monks concerning the following question:
The error refers to the line: my $CFG = $heap->{cfg}->{device}->{$name}->{localfile}; And of course is: "Can't use string ("XX.XX.XX.XX) as HASH ref while "strict refs" in use". Basically the IP of the device is considered to be a string and can't be used as a hash ref... I've read tens of posts about how to fix this but - definitely also because of my very bad knowledge of PERL after years of non-practice - but can't find how to fix it... can you help me finding the possible solution? Thanks!! Stibbasub check_configs { my ($kernel, $heap) = @_[KERNEL, HEAP]; my $RCS = Rcs->new; $RCS->bindir('/usr/bin'); $RCS->workdir($heap->{cfg}->{default}->{destination}); $RCS->rcsdir($heap->{cfg}->{default}->{rcsdir}); $RCS->quiet(1); print "\nStart CFG check at: ".localtime()."\n"; foreach my $name (@{ $heap->{cfg}->{devices} }) { my $CFG = $heap->{cfg}->{device}->{$name}->{localfile}; if (-f $CFG) { my $md5 = eliminate_timestamps($CFG); $RCS->file(basename($CFG)); $RCS->ci('-l', "-t-Configfile for $name", "-mMD5-sum: $md5"); } else { print "Error: File $CFG does not exist\n"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Again on "can't use string as hash as HASH ref while "strict refs" in use"
by Corion (Patriarch) on Aug 26, 2015 at 07:12 UTC | |
|
Re: Again on "can't use string as hash as HASH ref while "strict refs" in use"
by stevieb (Canon) on Aug 26, 2015 at 13:23 UTC | |
|
Re: Again on "can't use string as hash as HASH ref while "strict refs" in use"
by stibba (Initiate) on Aug 26, 2015 at 14:10 UTC | |
by Corion (Patriarch) on Aug 26, 2015 at 14:19 UTC | |
by stevieb (Canon) on Aug 26, 2015 at 14:27 UTC | |
by poj (Abbot) on Aug 26, 2015 at 15:31 UTC |