Ronnie has asked for the wisdom of the Perl Monks concerning the following question:
The error message looks like an unwinding error to a numpty like me but here it is anyway.#!/usr/bin/perl -w # ####################################### # Perl Modules Used #-------------------------------------- use strict ; use Cwd ; # Current Working + Directory Module use Mail::Sender; # Email module use lib '/home/interface/scripts/Perl_Modules' ; # Where ACC_Vario +us lives # sub ACC_IHS_PROFILE { use strict ; # # # Scalar Variables #-----------------# my $db = undef ; my $DB_hash = undef ; my $key = undef ; my $paramno = undef ; my $value = undef ; # # Array Variables #---------------# # # Boolean Variables #-----------------# my $PARAMNO = 0 ; my $PARAMETER_ERROR = 0 ; # # HASH Table for LIVE environment #-------------------------------# my %LIVE = ( "ADMIN_DIR" => "/opt/bin1", ); # # HASH Table for DEVLP environment #--------------------------------# my %DEVLP = ( "ADMIN_DIR" => "/opt/bin2", ); # # HASH Table for TEST environment #--------------------------------# my %TEST = ( "ADMIN_DIR" => "/opt/bin3", ); # my %DBhashlookup = ( "TEST" => [\%TEST], "LIVE" => [\%LIVE], "DEVLP" => [\%DEVLP], ) ; # P R O C E S S I N G #-------------------# $paramno = (@_) ; # if ($paramno == 0) { print "\n\tNo parameters supplied - can't set up environment!\n" + ; $PARAMETER_ERROR = 1 ; } if ($paramno > 1) { print "\n\tToo many parameters supplied - Highlander!\n" ; $PARAMETER_ERROR = 1 ; } if (! $PARAMETER_ERROR) { $db = $_[0] ; if (($db ne "LIVE") && ($db ne "TEST") && ($db ne "DEVLP")) { print "\n\tDB $db is not known to this script\n" ; $PARAMETER_ERROR = 1 ; } } if (! $PARAMETER_ERROR) { $DB_hash = $DBhashlookup{$db} ; while (($key, $value) = each %$DB_hash ) { print "\n\tKEY :: $key\n" ; print "\n\tVALUE :: $value\n" ; $ENV{$key} = $value ; } } if ( $PARAMETER_ERROR ) { return 0 ; } else { return 1 ; } # } # # Scalar Variables #----------------# my $db = 'DEVLP' ; my $key = undef ; my $script = "xxrctest" ; my $value = undef ; # # Array Variables #----------------# # # Boolean Variables #-----------------# print "\n\t$script S T A R T S\n" ; &ACC_IHS_PROFILE($db) or die "\n\tBottom - Sub Failed!\n" ; print "\n\t$script E N D S\n" ;
Please let me know what folly I'm commiting here as I can't see it and it's begining to drive me insane(r)! Cheers, Ronniexxrctest S T A R T S Argument "/opt/bin2" isn't numeric in each at ACC_IHS_PROFILE.pl line +85. Bad index while coercing array into hash at ACC_IHS_PROFILE.pl line 85 +.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hash Table References?
by liverpole (Monsignor) on Jun 20, 2006 at 10:44 UTC | |
|
Re: Hash Table References?
by GrandFather (Saint) on Jun 20, 2006 at 10:57 UTC | |
by Ronnie (Scribe) on Jun 20, 2006 at 11:28 UTC | |
|
Re: Hash Table References?
by johngg (Canon) on Jun 20, 2006 at 10:58 UTC |