use strict; use warnings; <DATA>; #throw away first line my %names; while (<DATA>) { my ($name) = (split ' ',$_)[1]; print unless $names{$name}++; } =PRINTS 123 john 11 peter 87 helen =cut __DATA__ id name 123 john 34 john 567 john 11 peter 899 peter 87 helen
In reply to Re: Very basic question while reading a file line by line
by Marshall
in thread Very basic question while reading a file line by line
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |