Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Processing words in a file.

by vinoth.ree (Monsignor)
on Feb 12, 2013 at 05:39 UTC ( #1018299=note: print w/replies, xml ) Need Help??

in reply to Processing words in a file.

I guess you need first word of each line from the file

use strict; use warnings; open FH, '<', "filename.txt" or die "Can not open file $!"; while(<FH>) { my ($first_word) = $_ =~ /^(\w+)/; if ($first_word eq 'your string') { #Your wish. } }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018299]
[GotToBTru]: that sounds fair to me
[davies]: I've just "approved" using syscalls in perl through inline c for at least the third time, but it still appears to me as unapproved. Is this just me?
[LanX]: erix: other side of the pond
[LanX]: davies: same problem
[Corion]: It had been approved as a Perl Monks Discussion. It should now be approvable into SoPW
[choroba]: Approved
[LanX]: hmm aproval doesn't stick after move? Or was it a race condition

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (11)
As of 2017-01-16 15:07 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (151 votes). Check out past polls.