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