in reply to Simplify This

@iparray = ( $record =~ m[(\d+)]g )[0..3];

Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.

Replies are listed 'Best First'.
Re: Re: Simplify This
by ChrisR (Hermit) on Sep 30, 2003 at 18:58 UTC
    This returns a value of 4. I was looking for a value of "100.100.100.100".

    OOPS: Sorry about that. It does return what I was looking for. THANKS

    That's great!! This is short,easy to understand, and doesn't use unnecessary functions. Thanks again.

      Pardon?

      perl> print $record 100.100.100.100 1COMPUTER1 09/13/30828 22:48:05 perl> print +($record =~ m[(\d+)]g)[0..3] 100 100 100 100 perl>

      The original code place the numeric value of the four octets into the array @iparray -- so does this.


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
      If I understand your problem, I can solve it! Of course, the same can be said for you.

      I was looking for a value of "100.100.100.100"

      Huh? From the code you gave, I assumed you were looking for a value of (100, 100, 100, 100) (i.e., a list of four values).


      $;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/