# this is a lazy regexp - you can refine it better, I'm sure. # $line is the line of text from your example @emails = grep ( /.*\@.*/, split( /\|/, $line ) );