use Modern::Perl; while ( my $string = ) { given ($string) { when (/<=/) { say '<= was found.'; } when (/=>/) { say '=> was found.'; } when (/==/) { say '== was found.'; } when (/\*\*/) { say '** was found.'; } default { say "The following was found: $_"; } } } __DATA__ May 2 07:06:20 lon.mail.net exim[1234]: 2012-05-02 07:06:20 1PSPtU-0004en-1e <= it_ndt_bounces@new.itunes.com H=smtpmail.com [21.5.10.4] I=[8.4.14.4]:25 P=esmtp S=1966 id=1603882764.112965659.1335927964793.Mail.cboxp@ednabay.apple.com T="New on iTunes: One Thing And, Then Another, Cooking Apps,\n Great Deals on First Seasons, and M" May 2 07:06:20 lon.mail.net exim[1234]: 2012-05-02 07:06:20 1PSPtU-0004en-1e <= it_ndt_bounces@new.itunes.com H=smtpmail.com [21.5.10.4] I=[8.4.14.4]:25 P=esmtp S=1966 id=1603882764.112965659.1335927964793.Mail.cboxp@ednabay.apple.com T="New on iTunes: One Thing And, Then Another, Cooking Apps,\n Great Deals on First Seasons, and M" May 2 07:06:20 lon.mail.net exim[1235]: 2012-05-02 07:06:20 1PSPtU-0004en-1e => peterpiper R=local_mail T=local_maildir_mail_drop May 2 07:06:20 lon.mail.net exim[1235]: 2012-05-02 07:06:20 1PSPtU-0004en-1e == peterpiper R=local_mail T=local_maildir_mail_drop May 2 07:06:20 lon.mail.net exim[1234]: 2012-05-02 07:06:20 1PSPtU-0004en-1e ** it_ndt_bounces@new.itunes.com H=smtpmail.com [21.5.10.4] I=[8.4.14.4]:25 P=esmtp S=1966 id=1603882764.112965659.1335927964793.Mail.cboxp@ednabay.apple.com T="New on iTunes: One Thing And, Then Another, Cooking Apps,\n Great Deals on First Seasons, and M" May 2 07:06:20 lon.mail.net exim[1235]: 2012-05-02 07:06:20 1PSPtU-0004en-1e -- peterpiper R=local_mail T=local_maildir_mail_drop #### <= was found. <= was found. => was found. == was found. ** was found. The following was found: May 2 07:06:20 lon.mail.net exim[1235]: 2012-05-02 07:06:20 1PSPtU-0004en-1e -- peterpiper R=local_mail T=local_maildir_mail_drop