in reply to help with regular exprestion

use 5.010; my @chunks = split " ", "Debashis Pranab roy Nagendra roy murali mohan + roy"; for (1..$#chunks) { say $chunks[$_-1] if $chunks[$_] eq "roy"; }

Update: change range to start at 1, so that a leading "roy" doesn't result in the last item being printed, as pointed out by jethro++.