Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Very basic question while reading a file line by line

by Marshall (Canon)
on Dec 10, 2022 at 09:01 UTC ( [id://11148711]=note: print w/replies, xml ) Need Help??


in reply to Very basic question while reading a file line by line

another solution
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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11148711]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2024-04-24 17:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found