On Tuesday, April 23, 2002, at 09:28 , Nazary, David wrote:
[..]
> 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;

assuming the 'not writing here' issue is that
the 'open(NEW, ">$name") isn't working....
        { and should have the die so that when you use '-w' and 'use strict'
        it would complain if there was a 'bad file name' ..... }

How about instead of "NEW" you used

        NAME_FH

the other problem may be the grep itself since
you have set up '$name' you might want to use it
directoy in your grep -

        @labeled_names = grep(/$name/, @labels);


also - since you have slurped in the 'names' and labels
why not put the close up near them before going into the loop?



ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to