Skip to content

Instantly share code, notes, and snippets.

@earnhardt3rd
Created June 19, 2023 13:56
Show Gist options
  • Select an option

  • Save earnhardt3rd/41fdbf0f01bc69f8ea072c58d97e28ed to your computer and use it in GitHub Desktop.

Select an option

Save earnhardt3rd/41fdbf0f01bc69f8ea072c58d97e28ed to your computer and use it in GitHub Desktop.
require 'getopts.pl';
Getopts('m:d:t');
my $MODE = uc($opt_m) || "";
my $DEBUG = $opt_d || 0;
if (defined $opt_t) { my %TEST = &fromHASHKeys2RRAAY();}
1;
sub fromHASHKeys2RRAAY {
print " =============== FROM HASH KEY 2 ARRAY===============\n" if $DEBUG > 0;
my %H = @_;
my %RTN;
my @HKEYS;
print " HASH_COUNT:" . scalar(keys %H) . "\n";
foreach my $hk(sort keys %H) {
if (defined($HAG)) {
next if ($hk =~ /^${HAG}/);
}
print " DEBUG_fromHASH:KEY=$hk\n" if $DEBUG > 0;
push(@HKEYS,$hk);
}
my @ANS;
if (uc($MODE) =~ /CRON/) {
@ANS = @HKEYS;
} else {
if (scalar(@HKEYS) == 1) {
@ANS = @HKEYS;
} else {
@ANS = &fromARRAY(@HKEYS);
}
}
return @ANS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment