Adriano Allora wrote:
> hi to all,
Hello,
> this question isn't exactly a cgi-question, but I need to solve this
> problem before writing the cgi interface.
>
> I've got a list of tagged files.
> I've listed all the couple word+tag.
> now, for each word+tag I want to write a file containing all the
> filename in which compare the couple.
>
> This is the script:
>
> `sort tagged_files/* | uniq > word+tag.txt`;
perldoc -q "backticks in a void context"
> open(IDX, "<word+tag.txt");
You should verify that the file was actually opened.
> while(<IDX>)
> {
> next if /^\W.+/;
> open(TMP, ">indexes/$_.txt");
You should verify that the file was actually opened.
> $where = `grep -L '$_' tagged_files/*`;
> print TMP $where;
> close(TMP);
> }
>
> someone would tell me why the line with grep does not work?
The string in $_ has a newline at the end.
> Is this the fastest way?
sort -u tagged_files/* > word+tag.txt
grep -L -f word+tag.txt tagged_files/*
Or did you really want to do it in Perl?
Maybe if you could explain in more detail exactly what you want to do?
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>