CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: Match or No Match, that is the question!!: Edit Log



English Guy
New User

Sep 2, 2002, 9:16 AM


Views: 3840
Match or No Match, that is the question!!

Hi, I have a simple script, which reads an email file, then greps another file which has the email address & real name of the users, then prints the email address & name if it finds a match, or prints No Match for $line if no match found. I cannot get it to wortk though!! My code is as follows -

open(FILE, "$path/$file");

foreach $line(<FILE>) {

open(GREP, "cat $path | grep $line|");

while(<GREP>) {

if (/(\S+)\s?[-]\s?(\S+\s+\S+)/) { print "$1 - $2"; } #jsmith@dot.com - John Smith

else { print "No Match for $line"; }

}
}

close(GREP);

close(FILE);



Any Help appreciated!!!!


(This post was edited by English Guy on Sep 2, 2002, 9:16 AM)


Edit Log:
Post edited by English Guy (New User) on Sep 2, 2002, 9:16 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives