I need to create a hash with a key/value pair as text:nontext like so:
savecrash as the key and 1 as the value
savecrash_dir as the key and /var/adm/crash as the value.
The output from each is giving 1 (true) but I need to have the values as
I stated above.
Here is my code and below that is the output
require 5.6.1;
use strict;
use warnings;
use diagnostics;
#use MIME::Lite;
$ENV{"PATH"} = qq(/usr/sbin:/usr/bin:/usr/local/log);
delete @ENV{qw (IFS CDPATH ENV KSH_ENV) };
#my (@vg,@lvln) = ();
my ($vg,$lvln) = 0;
my (%vg,%lvln) = ();
my $savecrash = qq(/etc/rc.config.d/savecrash);
my $crashconf = qq(/etc/rc.config.d/crashconf);
my $log = qq(/usr/local/log/hpux_verify.pl.log);
##-- BEGIN ROUTINES --##
my $overide = $SIG{__DIE__}; ## get error handler currently
assigned 2 die
$SIG{__DIE__} =
sub {
my $error = shift; ## error now holds the mesg passed to
die
$overide->($error) if (ref $overide);
print LOG ($error);
};
sub dateme {
my ($month,$day,$year) = (localtime)[4,3,5];
sprintf ("%02d/%02d/%02d\n", $month+1,$day,($year % 100));
}
open (LOG, ">>$log") || die "unable to open $log $!";
open (SC, "+<$savecrash") || die "unable to open $savecrash $!";
for (;<SC>;) {
if ( /(?i)savecrash=/ || /(?i)savecrash_dir=\W+\w+/ ) {
chomp;
$vg{$_}++;
}
}
while (my ($k,$v) = each %vg) {
print "$k\t:$v\n";
}
close (SC) || warn "unable to close $savecrash $!";
close (LOG) || warn "unable to close $log $!";
_OUTPUT__
SAVECRASH=1 :1
SAVECRASH_DIR=/var/adm/crash :1
Thank you
Derek
Cardinal Health -- Working together. For life. (sm)
_________________________________________________
This message is for the designated recipient only and may contain privileged,
proprietary, or otherwise private information. If you have received it in
error, please notify the sender immediately and delete the original. Any other
use of the email by you is prohibited.
Dansk - Deutsch - Espanol - Francais - Italiano - Japanese - Nederlands - Norsk
- Portuguese - Svenska: www.cardinalhealth.com/legal/email