in reply to Matching Text
This may be what you're looking for:
#!/usr/bin/perl use strict; use warnings; my %names; while (<DATA>) { chomp; my ($name, $lastThingy) = (split /,/)[0,3]; push @{$names{$name}}, $lastThingy; } foreach my $key (keys %names) { my $values = join ',', (@{$names{$key}}); print "$key,$values\n"; } __DATA__ Kim,0,0,off Kim,1,1,on Tyra,0,0,off Tyra,1,1,on Rada,0,0,zero Rada,1,1,one
Update: v5.6.1 built for cygwin-multi doesn't print out the key, but v5.8.0 built for MSWin32-x86-multi-thread does. Weird.
Cē
|
|---|