#!/usr/bin/perl use strict; use warnings; my %hash; while (my $line = ) { next if $line =~ /^\s*$/; #skip blanks chomp $line; my ($value, $key) = split ':',$line,2; push @{$hash{$key}},$value; } foreach my $key (sort keys %hash) { print "$key => @{$hash{$key}} ERROR Single Node!\n" if @{$hash{$key}}<2; } =prints vg3:38 => node1 ERROR Single Node! vg3:40 => node2 ERROR Single Node! =cut __DATA__ node1:vg1:36 node2:vg1:36 node1:vg2:37 node2:vg2:37 node1:vg3:38 node2:vg3:40