http://qs321.pair.com?node_id=466835


in reply to Extracting non-consecutive but related items from an array.

This is just the thing hashes exist for:

#Untested use strict; my %data; #assume file is opened as <INPUT> while (<INPUT>) { chomp; my ($server,@apps_info)=split /,/; push @{$data{$server}}, \@apps_info; } foreach my $server ( keys %data ) { print "$server\n\t"; for ( @{$data{$server}} ) { print join " ", split /,/; print "\n\t"; } }

Basically, pull all of the data into a hash with the server name as keys.

Update: Updated as per Tomtom's remark

CU
Robartes-