in reply to Re: Better way to perform "double split" ?
in thread Better way to perform "double split" ?

Well , i thought of that too, but it is a requirement to store the output in a scalar.
  • Comment on Re^2: Better way to perform "double split" ?

Replies are listed 'Best First'.
Re^3: Better way to perform "double split" ?
by rovf (Priest) on Nov 10, 2009 at 11:21 UTC

    Well, thinking of it, you could of course also operate on substr($cmd_output,rindex($cmd_output,"\n")+1) which also would eliminate one split, but I admit that this doesn't look very elegant either. But if the format is always as shown in your example (in particular, the usage of white space), you could get the date by

    (split(/(\s|\n)/m,$cmd_output))[-3]

    (BTW, I believe that the m modifier can even be left out here - what do the experts say?).
    -- 
    Ronald Fischer <ynnor@mm.st>