in reply to A Better Way to Find the Position of the Last Non-Whitespace Character in the Last Element of an Array.

rindex( $MessageLines[ -1 ], ':' ) comes immediately to mind. If that's -1 there's no ':' in it (but then reading the rindex docs would tell one that).

The cake is a lie.
The cake is a lie.
The cake is a lie.

  • Comment on Re: A Better Way to Find the Position of the Last Non-Whitespace Character in the Last Element of an Array.
  • Download Code

Replies are listed 'Best First'.
Re^2: A Better Way to Find the Position of the Last Non-Whitespace Character in the Last Element of an Array.
by NateTut (Deacon) on Apr 22, 2009 at 21:18 UTC
    I originally tried rindex, but the last non whitespace character won't always be a colon unfortunately.

      Aaah, I missed that qualification (got stuck on the specific example). $idx = $+[1] if $MessageLines[-1]=~/(\S)\s*$/ then.

      The cake is a lie.
      The cake is a lie.
      The cake is a lie.