# untested for(@str) { /^(?:(\w{2}_[a-z0-9]+)|([a-z0-9]+)_)/i and print $1 || $2, "\n"; }