Hi, I am trying to use grep in a simple perl script to find all the lines in a list (@labels) that contain certain names in a list (@names). The problem is that grep finds all the lines in @labels for every name in the @names. here is the script:
>>>>>>>>>>>> open(NAMES, "names"); open(LABELS, "labels"); @labels = <LABELS>; @names = <NAMES>; foreach $name (@names){ open(NEW, ">$name"); #create a file with the name from @names @labeled_names = grep (/$_/, @labels); print NEW @labeled_names; @labeled_names = ""; #clear the list for the next name close NEW; } close NAEMS; close LABELS; >>>>>>>>>>>>> any idea what is not write here? Thanks in advance David -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]