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 <
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
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
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
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
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(
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
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
> [
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