Hi, Observe this output I get from a command ran from my perl script, which I OPEN as a filehande:
eg. open (FILEH, "unix_command_to_generate_output |")
1016 000b 0.2 10000000C9311154 magellan.c1
1016 000b 0.2 10000000C931106D magellan.c2
1017 000c 0.2 10000000C9310EDC columbus.c1
1017 000c 0.2 10000000C9310F95 columbus.c2
1017 000c 0.2 10000000C9311154 magellan.c1
1017 000c 0.2 10000000C931106D magellan.c2
1018 0000 20.1 10000000C9381CE7 tiger.c1
1018 0000 20.1 10000000C9381E92 tiger.c2
1019 0001 20.1 10000000C9381CE7 tiger.c1
1019 0001 20.1 10000000C9381E92 tiger.c2
101a 0002 20.1 10000000C9381CE7 tiger.c1
The elements are split via a newline, so the next thing I do is:
while (<FILEH>)
{
(my $Volume,my $LUN,my $Size,my $Initiator,my $FullHost,my $Rest) = split('/\s+/');
}
Now I really want to lose the duplicates eg. all the .c2's then store the entire lot in a hash indexed by $Volume.
how do I do this?
cheers,
Dave.
eg. open (FILEH, "unix_command_to_generate_output |")
1016 000b 0.2 10000000C9311154 magellan.c1
1016 000b 0.2 10000000C931106D magellan.c2
1017 000c 0.2 10000000C9310EDC columbus.c1
1017 000c 0.2 10000000C9310F95 columbus.c2
1017 000c 0.2 10000000C9311154 magellan.c1
1017 000c 0.2 10000000C931106D magellan.c2
1018 0000 20.1 10000000C9381CE7 tiger.c1
1018 0000 20.1 10000000C9381E92 tiger.c2
1019 0001 20.1 10000000C9381CE7 tiger.c1
1019 0001 20.1 10000000C9381E92 tiger.c2
101a 0002 20.1 10000000C9381CE7 tiger.c1
The elements are split via a newline, so the next thing I do is:
while (<FILEH>)
{
(my $Volume,my $LUN,my $Size,my $Initiator,my $FullHost,my $Rest) = split('/\s+/');
}
Now I really want to lose the duplicates eg. all the .c2's then store the entire lot in a hash indexed by $Volume.
how do I do this?
cheers,
Dave.