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

Try this...
#!/usr/bin/perl use strict; my @MessageLines = ('Message Line 1', 'Message Line 2', 'Message Line3 +', 'Prompt: '); $MessageLines[-1] =~ s/\s+|\s//; my $last_char = substr( $MessageLines[-1], -1 ); print $last_char;
  • 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