in reply to Get middle word

my ($result)= m{ FIXED (.*?) FIXED }x;

Just to make sure I used a non-greedy match (the ? makes the * match as few characters as possible). That won't make a difference until more than 2 'FIXED' strings are in one line

Replies are listed 'Best First'.
Re^2: Get middle word
by sauoq (Abbot) on Mar 01, 2010 at 03:07 UTC
    my ($result)= m{ FIXED (.*?) FIXED }x;
    That fails on strings like "FIXEDfooFIXEDbarFIXED" without making any assumptions beyond the stated requirements. A greedy match seems right here.
    -sauoq
    "My two cents aren't worth a dime.";