[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Perl Filter Demos?




Hi Tom,

>>#!perl -nl
>>print unless $s{$_}++
>
>This is verry pretty.
>I will have to figure out what it does exactly.

broken into sections:

$_=$WORD;
$HASH {$WORD} ++;

#take the word
#use it as the name for a hash table entry
#the value assigned to the key  is an auto increment
#each time the script encounters the word it adds 1 to the value for that
hash entry

print unless $HASH{$WORD}++;
# if the word ISN'T in the hash it must be new so print it out

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org