in reply to How to print months in proper order from array
Are you trying to sort unique per client?
use warnings; use strict; use Data::Dumper; my %clients; while (<DATA>) { my ($client, $rest) = split /\|/; $rest =~ s/\s+//g; my @months = split /\d+/, $rest; $clients{$client} = \@months; } print Dumper \%clients; __DATA__ IBM | February 1 March 5 July 4 Oracle| January 3 March 4 April 6 May 5 RedHat | March 2 June 3 August 1
Output:
$VAR1 = { 'IBM ' => [ 'February', 'March', 'July' ], 'Oracle' => [ 'January', 'March', 'April', 'May' ], 'RedHat ' => [ 'March', 'June', 'August' ] };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to print months in proper order from array
by dirtdog (Monk) on Aug 30, 2016 at 20:13 UTC | |
by stevieb (Canon) on Aug 30, 2016 at 20:22 UTC | |
by dirtdog (Monk) on Aug 30, 2016 at 20:46 UTC | |
by Not_a_Number (Prior) on Aug 31, 2016 at 08:55 UTC |