7e3afbba |
1 | #!/usr/bin/perl |
e99ec255 |
2 | # jibberish -- run filters in random order |
7e3afbba |
3 | |
4 | $ENV{PATH}.=":/usr/games"; |
5 | |
6 | @all= qw( |
dc17484a |
7 | eleet |
8 | b1ff |
9 | chef |
10 | jethro |
11 | upside-down |
12 | kraut |
13 | cockney |
7e3afbba |
14 | jive |
7e3afbba |
15 | nyc |
bc19f2cf |
16 | ken |
17 | ky00te |
0652168f |
18 | rasterman |
7e3afbba |
19 | newspeak |
9edc0e61 |
20 | studly |
e99ec255 |
21 | censor |
22 | spammer |
7e3afbba |
23 | ); |
24 | |
25 | # shuffle order |
26 | srand; |
27 | for (0..$#all) { |
28 | my $n= @all*rand; |
29 | my $was= $all[$_]; |
30 | $all[$_]= $all[$n]; |
31 | $all[$n]= $was; |
32 | } |
33 | |
34 | # start the pipe... |
e99ec255 |
35 | my $pipe= join '|', @all[0..3 + rand(5)]; |
7e3afbba |
36 | open FILTER, "$pipe|" |
e99ec255 |
37 | or die "Never mind...\n"; |
7e3afbba |
38 | |
39 | # display the results |
40 | while (<FILTER>) { |
41 | print $_ |
42 | } |
43 | |
44 | # This could be optimized: take the last program off the pipeline, |
45 | # open the pipeline as standard input, then exec that last program. |
46 | # |
47 | # But you have to ask yourself: how important is it to optimize |
48 | # the generation of jibberish? |