in reply to Gimmie the Stuff Between Two Keywords

$text = "xcystartsdhjsXYZ:joeblow@mail.cpEwrendrwerwep"; if ($text =~ /\bXYZ:\b(.*?)\b@mail.cp\b/) { $result = $1; # do something with results print $result, $1; }
That prints nothing because there's no /\bXYZ:\b/ in that string! Give it a start/end point that actually occurs, and you'll see you're on the right track.

-- Randal L. Schwartz, Perl hacker