#!/usr/bin/perl $to = "abchello"; if ($to =~ /^.+@hello$/i) { print "#1 matches\n"; } $to = "abc@hello"; if ($to =~ /^.+@hello$/i) { print "#2 matches\n"; }