Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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.


Comment on Re: Cant help print key word
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (17)
As of 2014-07-10 20:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (215 votes), past polls