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

Re: Regex and splitting

by Kenosis (Priest)
on Apr 29, 2012 at 05:45 UTC ( #967900=note: print w/replies, xml ) Need Help??

in reply to Regex and splitting

Although this solution doesn't use split, you can capture the ip between the colon and comma with just a regex--given your file's contents:

use strict; use warnings; use 5.010; say /:(.*),/ while <DATA>; __DATA__ host1 dns:,asdf host2 dns:,qwert

I know this doesn't specifically address your "Is there something missing with my code?" question, as the prior comments effectively have, but it may be interesting information to you.

Hope this helps!

Replies are listed 'Best First'.
Re^2: Regex and splitting
by Anonymous Monk on Apr 30, 2012 at 04:22 UTC

    Actually the one GodFather helped me by removing the $ sign and just split it if in case i want to display only the ip address. Thanks for the help really appreciate :)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://967900]
[james28909]: I have a problem I am trying to solve. I am packaging scripts using pdk and would like the verify the executable name each time it is executed
[Corion]: Hi James!
[james28909]: I looked through the docs, and see that PerlApp::exe() is suppose to return this information but whenever i try to use this, i get the error "Undefined subroutine &PerlApp::exe called"
[james28909]: i just want to verify the integrity of the executables name each time it is run.
[Corion]: Weird. this documentation says what you say.
[Corion]: I assume you are experiencing this with your packaged program. Maybe also include in the packaging list?
[james28909]: has anyone else run into this problem? i have tried searching but have not returned many results
[james28909]: ah, good idea.
[Corion]: What does print $PerlApp::VERSION output?

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (13)
As of 2017-07-28 13:53 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (429 votes). Check out past polls.