in reply to Re: File write
in thread File write
Here noun I am verb this is me Theres advb nowhere else on earth Id ra +ther be
foreach (keys %tagdict){ print CF $tagdict{$_} if exists $tagcorpus{$_}; }
open DF, 'd.txt' or die $!; my %tagdict; while (<DF>) { chomp; my ($word, $cat) = split; $tagdict{$word} = $cat; } while ( ($k,$v) = each %tagdict ) { #print "$k => $v\n"; } close DF; open CF, '+<c.txt' or die $!; my %tagcorpus; while (<CF>) { chomp; my @cwords = split; @tagcorpus{@cwords} = (1) x @cwords; } while ( ($k,$v) = each %tagcorpus ) { #print "$k => $v\n"; } close CF; open CF, '+<c.txt' or die $!; seek CF, 0, 0; # go to start of file truncate CF, 0; foreach $ditem(keys %tagdict){ #print "\n$ditem"; foreach $vitem(values %tagdict){ #print "\n$vitem"; $_ = process($_); #print $_; print CF; print CF " "; foreach $citem(keys %tagcorpus) { #print "\n$vitem"; my $currentposition=tell CF; seek CF,0,1 ; if ($citem eq $ditem){ syswrite CF,"$vitem",4 ; } } } } close CF; sub process{ foreach $key(keys %tagcorpus){ #print "\n$key"; return($key); } } 1;
foreach $key(keys %tagcorpus){ #print "\n$key"; return($key); }
while ( ($k,$v) = each %tagcorpus ) { #print "$k => $v\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: File write
by BrowserUk (Patriarch) on Jun 27, 2003 at 11:53 UTC | |
by perl_seeker (Scribe) on Jul 02, 2003 at 11:54 UTC | |
by BrowserUk (Patriarch) on Jul 02, 2003 at 14:02 UTC | |
by perl_seeker (Scribe) on Oct 08, 2003 at 09:47 UTC |