Re: Reading and matching email ids

2007-04-25 Thread Saravana Kumar
Saravana Kumar wrote: > yitzle wrote: > >> You can read one list into an array (@list) and then loop through the >> other file ($item) and grep the list for the item. >> >> for ($item = <>) { # or foreach >> print "$item found" if ( grep $item, @list ); >> } >> >> On 4/20/07, Saravana Kumar <

Re: Reading and matching email ids

2007-04-20 Thread Saravana Kumar
yitzle wrote: > You can read one list into an array (@list) and then loop through the > other file ($item) and grep the list for the item. > > for ($item = <>) { # or foreach > print "$item found" if ( grep $item, @list ); > } > > On 4/20/07, Saravana Kumar <[EMAIL PROTECTED]> wrote: >> Boga S

Re: Reading and matching email ids

2007-04-20 Thread Higashi Noboru
Hi yitzle, The reason to escape @ inside a double-quoted string is to prevent Perl from treating @example as an array. # gives $id = "user1.com" since @example is empty $id = "[EMAIL PROTECTED]"; To prevent this, I believe it's better to use single quotes here $id = '[EMAIL PROTECTED]'; I

Re: Reading and matching email ids

2007-04-20 Thread John W. Krahn
Saravana Kumar wrote: > Hi list, Hello, > 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 use warnings; use strict; > $id="[EMAIL PROTECTED]"; Scalars and arrays are interpolated in double qu

Re: Reading and matching email ids

2007-04-20 Thread yitzle
I fail to see the need to escape the @ and . A . needs to be escaped in RegEx to avoid confusion with the 'match any character', but otherwise, I don't think you want the slash there. On 4/20/07, Higashi Noboru <[EMAIL PROTECTED]> wrote: try this $id = "[EMAIL PROTECTED]"; cheers -- To unsub

Re: Reading and matching email ids

2007-04-20 Thread Higashi Noboru
try this $id = "[EMAIL PROTECTED]"; cheers On 4/20/07, Saravana Kumar <[EMAIL PROTECTED]> 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(

Re: Reading and matching email ids

2007-04-20 Thread yitzle
You can read one list into an array (@list) and then loop through the other file ($item) and grep the list for the item. for ($item = <>) { # or foreach print "$item found" if ( grep $item, @list ); } On 4/20/07, Saravana Kumar <[EMAIL PROTECTED]> wrote: Boga Srinivas wrote: > Hi kumar, > > T

Re: Reading and matching email ids

2007-04-20 Thread Saravana Kumar
Boga Srinivas wrote: > 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 > [

Re: Reading and matching email ids

2007-04-20 Thread Boga Srinivas
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