Why use a while loop and read line by line when there are other ways ?
#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11148698 use warnings; use List::AllUtils qw( uniq_by ); open my $fh, '<', \<<END; id name 123 john 34 john 567 john 11 peter 899 peter 87 helen END <$fh>; # skip first line print uniq_by { (split)[1] } <$fh>;
In reply to Re: Very basic question while reading a file line by line
by tybalt89
in thread Very basic question while reading a file line by line
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |