blink has asked for the wisdom of the Perl Monks concerning the following question:
When I dump the hash that this script creates, the inner hash, "tapes" can have duplicate values. I'll post some output to illustrate. I want only unique (in this case) tape id's to be included.
Here's some example output that I'm trying to avoid:#!/opt/openv/perl/bin/perl -w use strict; use Data::Dumper; use NBUX; my %images = bpimagelist(); #print Dumper(\%images); #exit; my (%status); foreach my $key (sort keys %images) { my ($tapes, $img); my $client = $images{$key}->{'client'}; my $sched_type = $images{$key}->{'schedule_type'}; my $sched_name = $images{$key}->{'sched_label'}; my $policy = $images{$key}->{'policy'}; my $kb = $images{$key}->{'kbytes'}; foreach my $key2 (sort keys %{$images{$key}}) { if ($key2 =~ /copy_\d_frag_\d_id/) { $img = $images{$key}{$key2}; $tapes = (join (' ', $img, $tapes)); $status{$client}{$policy}{'tapes'} = $tapes; } } } #print Dumper(\%status); #exit;
$VAR1 = { 'bondsrv1' => { 'acis_misc_os' => { 'tapes' => 'OK0238 OK0238 ' + } }, }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Join unless $var has already been joined?
by sgifford (Prior) on Sep 23, 2003 at 20:58 UTC | |
|
Re: Join unless $var has already been joined?
by Roger (Parson) on Sep 24, 2003 at 00:29 UTC |