Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Cant help print key word

by aitap (Deacon)
on Aug 28, 2012 at 15:31 UTC ( #990266=note: print w/replies, xml ) Need Help??


in reply to Cant help print key word

Well, firstly you read and print the entire file and then try to search in the remaining parts of the file (i.e nowhere). If you really want to work this way, you should seek to the beginning of the file.

Also, your $IP variable is declared inly inside the while loop. Declare it earlier (outside the loop) or print something from @IPS instead.

Also, you need another syntax for your matching:

($IP) = $line =~ /(\d+\.\d+\.\d+\.\d+)/;
Pattern matching returns an array, and you should assign an array (anonymous array is fine) if you want to get what matched (not the count of matches = array in scalar context).

Sorry if my advice was wrong.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://990266]
help
Chatterbox?
[Discipulus]: dear brother karl has "Furthermore I consider that Donald Trump must be impeached as soon as possible" in his sig
[erix]: ah, thanks Discipulus
[1nickt]: erix perhaps you could kindly point out your technique to roho and everyone will be happy.
[Discipulus]: but i'm also animalist, so i' hirted by 1nickt's sig: The way forward always starts with a mammal test... grin..
[erix]: I might if I did remember. It's probably somewhere in the site docs
[uhClem]: I don't favor that sort of thing around here but the place for our politics is wherever we live.
[uhClem]: And besides, the objection to it was off-topic.
[Discipulus]: 1nickt hide signature is a positive action; i think is not a solution here

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2017-06-22 12:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (519 votes). Check out past polls.