Hi kumar,

Try this.

[EMAIL PROTECTED]:~/perl$ cat reg.pl
#! /usr/bin/perl
$id="[EMAIL PROTECTED]";
while(<>) {
chomp($_);print "$_\t";
print "$id found\n" if  /$id/;
print "$id not found\n" if ! /$id/;
}

[EMAIL PROTECTED]:~/perl$ cat mail.txt
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]:~/perl$ ./reg.pl < mail.txt
[EMAIL PROTECTED]       [EMAIL PROTECTED] found
[EMAIL PROTECTED]       [EMAIL PROTECTED] not found
[EMAIL PROTECTED]       [EMAIL PROTECTED] not found


~Regards
-srini

Saravana Kumar wrote:
Hi list,

I am testing a regex with email ids. I have a list of ids that i want to
match against a one more list of ids.

I have this:
#! /usr/bin/perl
$id="[EMAIL PROTECTED]";
while(<>) {
chomp($_);print "$_\t";
print "$id found\n" if  /$id/;
print "$id not found\n" if ! /$id/;
}

and a file /tmp/sampleids
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

When i run it i get : [EMAIL PROTECTED] user1.net not found
[EMAIL PROTECTED]       user1.net not found
[EMAIL PROTECTED]       user1.net not found
[EMAIL PROTECTED]     user1.net not found

When i try to match simple text it works but matching email ids doesn't.
What am i doing wrong here?

Please help me with this.

TIA,
SK




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to