Please try and be more descriptive with the subject lines.

-----------------------------------------
Craig Moynes
[EMAIL PROTECTED]



                                                                                       
                             
                    "chris                                                             
                             
                    robinson"             To:     <[EMAIL PROTECTED]>                 
                             
                    <cyrobins@bigpo       cc:                                          
                             
                    nd.net.au>            Subject:     help!                           
                             
                                                                                       
                             
                    06/05/01 08:52                                                     
                             
                    AM                                                                 
                             
                                                                                       
                             
                                                                                       
                             



I have the following code.  This code prints a / for each occurance of a
certain number/word in a file.  How would I change this to print a / for
each 5 instances of a given word/number?

Thanks

#!/usr/bin/perl

my $file;
$file = $ARGV[0];
open( "file",  "< $file") or die "Cannot open image file $file\n";
$text = join('', <file>);
%count = ();
for (split(/\s/, $text)) {
 $count{$_} .="/";

}

foreach $word (sort keys %count) {
 next unless $word =~ /\d/;
 next if $word =~ /p2/i;
 next if $word =~ /^\#/
;

 printf("%-05s%s\n", $word, $count{$word});

}






Reply via email to