FAQ
Hello,

I'm not sure if the syntax below is correct:

next if /\/0$|^127\./;

( the regex means when meet something like 192.168.1.0/0 or 127.0.0.1
it will be next.)

Or do I need to use () to enclose the char at both sides of the "|" ?

next if /(\/0$)|(^127\.)/;

Please help, thanks!

Regards.

Search Discussions

  • John W. Krahn at Jul 18, 2009 at 3:29 am

    Jenn G. wrote:
    Hello, Hello,
    I'm not sure if the syntax below is correct:

    next if /\/0$|^127\./;

    ( the regex means when meet something like 192.168.1.0/0 or 127.0.0.1
    it will be next.)

    Or do I need to use () to enclose the char at both sides of the "|" ?

    next if /(\/0$)|(^127\.)/;
    No, it doesn't look like you need parentheses in this particular case.




    John
    --
    Those people who think they know everything are a great
    annoyance to those of us who do. -- Isaac Asimov
  • Dan Wallis at Jul 18, 2009 at 6:38 pm

    2009/7/18 Jenn G. <practicalperl@gmail.com>:
    next if /\/0$|^127\./;

    ( the regex means when meet something like 192.168.1.0/0 or 127.0.0.1
    it will be next.)
    When you say, "it will be next" it sounds like you want it to be
    processed. The next keyword stops this loop iteration short, and
    continues at the next iteration. See "perldoc -f next" for a better
    explanation than I can write.

    Dan

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupbeginners @
categoriesperl
postedJul 18, '09 at 2:39a
activeJul 18, '09 at 6:38p
posts3
users3
websiteperl.org

People

Translate

site design / logo © 2022 Grokbase