fadingjava has asked for the wisdom of the Perl Monks concerning the following question:
an array @morgr is created here and shuffled to look for the word in r +andom lines of the file open (MORG, "< /home/sid/kwicionary/$filename") or die "Can't open $fi +lename for reading: $!"; $path = "/home/sid/kwicionary/"; $indexname = "$path$filename.index"; sysopen(MIDX,$indexname, O_CREAT|O_RDONLY) or die "Can't open $indexna +me for read/write:$!"; build_index(*MORG, *MIDX) if -z $indexname; MORG:foreach (@morgr){ $line_number = $_; $line = line_with_index(*MORG,*MIDX,$line_number); if ($key =~ /\*/){ $key = substr($key,0,(length($key) -1)); @word = split(' ',$line); foreach (@word){ if ($_ =~ /$key/){ push (@morg_results , $_); } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: searching for a keyword with context window
by BrowserUk (Patriarch) on Nov 03, 2004 at 01:20 UTC | |
|
Re: searching for a keyword with context window
by TedPride (Priest) on Nov 03, 2004 at 02:55 UTC | |
|
Re: searching for a keyword with context window
by chromatic (Archbishop) on Nov 02, 2004 at 22:54 UTC | |
|
Re: searching for a keyword with context window
by ikegami (Patriarch) on Nov 02, 2004 at 23:02 UTC |