#! perl -slw use strict; use G; ## Expands wildcards arguments as would be done by most *nix shells. our $INDEX ||= 'words.index'; my %index; if( -e $INDEX ) { open INDEX, '<', $INDEX or die "$INDEX: $!"; m[^([^:]+):(\d+)$] and $index{ $1 } = $2 while ; close INDEX; } while( my $file = @ARGV ) { open FILE, '<', $file or warn "$file:$!" and next; while( ) { $index{ $_ }++ for split ' '; } close $file; } my( $key, $val ); open INDEX, '>', $INDEX or die "$INDEX : $!"; print INDEX "$key:$val" while ( $key, $val ) = each %index; close INDEX; #### P:\test>perl -c windex-1.pl windex-1.pl syntax OK #### P:\test>windex-1.pl *.pl 710:No such file or directory at P:\test\windex-1.pl line 15. 710:No such file or directory at P:\test\windex-1.pl line 15. 710:No such file or directory at P:\test\windex-1.pl line 15. 710:No such file or directory at P:\test\windex-1.pl line 15. ... #### while( my $file = pop @ARGV ) { #### P:\test>windex-1.pl *.pl 306836-trietest.pl:Permission denied at P:\test\windex-1.pl line 15, line 83342. #### P:\test>type words.index expletive:2 $midVal:30 9f:8 proven:2 AT:10 happpen:2 inconsequential:2 perverted:2 $x;:24 TTGGGTCAGCGAATGTCACATTTGGAATGGGAATCGGATGATGGGGGCGA:2 ++$x):2 greif:2 yvvvvvvvvvvhvevwvvy:2 @exclude_keys:2 $hh2,:2 scrapped:2 classe:2 sod:2 $array[2]->set($_);:2 Cleaner,:2 $expand_ratio,:8 CACGTCTCCACCCGAAGACTGTGGAATGCTACTATTAAAATACTATTTTT:2 cdpr:2 BLANK_NODE:4 paws:6 "\n$_:2 ...