Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

LeGo's scratchpad

by LeGo (Chaplain)
on Jun 02, 2004 at 00:55 UTC ( [id://358926]=scratchpad: print w/replies, xml ) Need Help??

it has been a while but getting back into perl I have created the following to parse IM messages and the like for a bit of info on the users.
@input = ( "M/C: blah blah blah", "C/M: wah wah wah", "C/M: wah wah ,wah", "C/M: wah wah, wah what then", "F/S: wah stfu you stupid moron", "S/F: ahahahaha ? hahaha", "S/F: ahahahaha ? hahaha", "C/M: count son" ); foreach (@input) { ($name,$text) = split(":",$_); $masterhash{$name}++; @words = split(/\W+/, $text); foreach (@words){ if($_ ne / /){ $anotherhash{ $name }{ $_ }++; } } } foreach $name (sort(keys %masterhash)){ print $name . ' = ' . $masterhash{$name} . " \n"; foreach $word (sort (keys %{ $anotherhash{ $name }} )){ print "\t$word = $anotherhash{$name}{$word} \n"; } }
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2025-06-25 08:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.