in reply to Re: Deleting duplicate lines from file
in thread Deleting duplicate lines from file
@unique{@lines} = (1) x @lines;
Also
@unique{@lines} = ();
since you don't use the values anyway. Whatever, if he wants them in the original order, then slurping the whole file in at once is, as is commonly the case, an overkill, and I would regard the usual print if !$seen{$_}++ technique as a superior solution. Of course if one needs or may need sorting then the slurping must take place in some form or another and yours is just as good as any other one. Probably you already knew, I'm just pinpointing some details for the benefit of the OP...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Deleting duplicate lines from file
by thundergnat (Deacon) on Feb 17, 2006 at 14:54 UTC | |
by blazar (Canon) on Feb 17, 2006 at 16:05 UTC |