#!/usr/local/bin/perl # # ungeek -- a perl script for parsing the code of the geeks. # # Copyright (c) 1994 by Robert L. McMillin. # # Send comments, corrections, and bugs to or # . # # This is version 1 of ungeek for v1.0.1 of the Geek code. # # # Abstract: # # This script parses and dumps to standard out Robert A. Hayden's geek code # that has become remarkably widespread on the Internet. I don't attempt # to explain here what it looks like; finger hayden@vax1.mankato.msus.edu # for a current copy of the code of the geeks. You should have received # a copy of the Geek code with this perl script distribution. # # # Invocation: # # ungeek [file1] [file2] ... # ungeek ; foreach (@lines) { tr/A-Z/a-z/; # # By increasing the repetition factor at the end of this term, we # can make the scanner a *lot* less sensitive to garbage. On the # other hand, it also becomes less sensitive to real stuff. # if (/((![a-z])|([a-z]\?)|(-[a-z]\+)|([a-z][+\-*]+)((\([+\-*]+\))|(\/\++|-+|\*+)+)?@?\s){2,}/o) { # # The line meets our rough requirements. Isn't that a nasty # regexp? # # # Divide and conquer. Split the line by whitespace and parse # each element separately. # @codes=split; foreach (@codes) { if (/\b(g((cs)|(at)|b|e|m|(mu)|s|(ss)|t|o|u))\b/o) { $type=$1; print "I am a geek of "; s/^g//; @types=split(/\//); $first=1; foreach (@types) { if (!$first) { print " and of "; } if ($_ eq "at") { print "all trades" ;} elsif ($_ eq "b") { print "business"; } elsif ($_ eq "cs") { print "computer science"; } elsif ($_ eq "m") { print "math";} elsif ($_ eq "mu") { print "music";} elsif ($_ eq "s") { print "science";} elsif ($_ eq "ss") { print "social science";} elsif ($_ eq "t") { print "theater";} elsif ($_ eq "o") { print "other";} elsif ($_ eq "u") { print "undecided";} else { print "unknown";} $first = 0; } print ".\n\n"; } else { # # Process each non-category code. # &parse_code($_); } } } } } if ($#ARGV == -1) { &parse_one_file(); } else { foreach (@ARGV) { open(STDIN,$_) || die ("unable to open '$f'\n"); &parse_one_file(); close(STDIN); } }