Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: getting syntex error in pattern search

by SerZKO (Beadle)
on Aug 22, 2012 at 09:19 UTC ( #988984=note: print w/ replies, xml ) Need Help??


in reply to getting syntex error in pattern search

If your code looked like this

open FILE,"config.txt" or die "cannot open file : $!"; while(<FILE>) { $ip = ($_ =~ m/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/ ) print "$ip"; # print $_; }
where would you put semicolon ?


Comment on Re: getting syntex error in pattern search
Download Code
Re^2: getting syntex error in pattern search
by choroba (Canon) on Aug 22, 2012 at 09:34 UTC
    After line 3, of course. Have you tried running the code? Also, prepending some spaces to the lines in the loop would not harm anybody.
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
      No I haven't tried to run the code choroba. I've just tried to point ulaksh to the right direction when it comes to syntax :-) .

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (10)
As of 2015-07-03 11:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (51 votes), past polls