in reply to printing the first column when both columns 2 and 3 are the same
Combine columns 2 and 3 to form the key of %duplicates.
use strict; use warnings; my %duplicates; while (<DATA>) { chomp; my( $tracking_number, $description ) = split /,/, $_, 2; print $tracking_number, "\n" if exists $duplicates{$description}; $duplicates{$description}++; } __DATA__ 161248,/vol/filelist,CABINET 161200,/vol/filelist,INVENTORY 161400,/vol/filelist,INVENTORY
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: printing the first column when both columns 2 and 3 are the same
by novice2015 (Acolyte) on Jun 27, 2016 at 17:53 UTC |