I do most of my studying/ prototyping on a mac.  I admit it.  I love my mac.  
So, I wrote a little script on my mac, as follows:


#!/usr/bin/perl
#  dedupe.pl

use strict;
use warnings;

my (@words, %schtuff, $word);                   # set up necessary variables.
open FH, "c:/data/filename.txt" or die $!;     # open a filehandle for the file 
to be read
@words = <FH>;                                            # put each row of the 
input file into the array, @words
foreach $word(@words) {                            # open a loop to iterate 
through each line in the array
        $schtuff{$word} +=1;                             # for each line in the 
array, make a key in the hash & increment a counter as the value.
        }

open OUTFILE, ">>c:/data/filename_dedup1.txt" or die $!;

        print OUTFILE keys %schtuff; 


On the mac, I tested it and found it worked successfully.  So, I brought it to 
work and put it on my windoze box.  Running active perl, it runs, but does not 
output any rows.  Does anyone have any thoughts or suggestions?  Also, any 
comments on how I could have coded this better or differently are always 
welcomed.

Jen

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to