"William Black" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Hello All,
>
> I have an array with the following lines, that always follow this format.  I
> need a regular expression that will just pull the data at the end of the
> sentence.  For example, only AZID, IA, KSOK, MO, NVUT, OR.
>
> The Wall will tell ME to update AZID.
> The Wall will tell ME to update IA.
> The Wall will tell ME to update KSOK.
> The Wall will tell ME to update MO.
> The Wall will tell ME to update NVUT.
> The Wall will tell ME to update OR.

Hi William.

What you write depends on whether you want to /check/ the contents
of the data or simply extract the final word.

This program will extract the last complete word from any array of
strings, but won't check that the string started with

  'The Wall will tell ME to update '

is this what you want?

HTH,

Rob



  use strict;
  use warnings;

  my @array = (
    'The Wall will tell ME to update AZID.',
    'The Wall will tell ME to update IA.',
    'The Wall will tell ME to update KSOK.',
    'The Wall will tell ME to update MO.',
    'The Wall will tell ME to update NVUT.',
    'The Wall will tell ME to update OR.',
  );

  my @lastword = map /.*\b(\w+)/, @array;

  print "$_\n" foreach @lastword;

OUTPUT

  AZID
  IA
  KSOK
  MO
  NVUT
  OR



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to