develooper Front page | perl.beginners | Postings from December 2002

one more regex match elements in an array question

Thread Next
From:
Ramprasad
Date:
December 20, 2002 03:30
Subject:
one more regex match elements in an array question
Message ID:
3E02FF3C.7030102@netcore.co.in
hello all

Assume the foll

$string='mail.com';
@array=qw(mail.com one.mail.com two.mail.com mail.com/one mail1.com);

@match = grep{..}@array;

I want to match all  that *contain* $string but is not equal to $string

so I came up with

@match = grep{/^$string.+/ || /.+$string$/} @array;

is there any better way
Thanks
Ram


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About