Back when I was using 'banner', I was a newcomer to Perl. And one of the things I did to amuse myself as an exercise was to write my own versions of banner. This one I found particularly edifying. I hope you will, too.

Rob

Update: I added in mappings for /SH/ /NG/ /NK/ /MP/ /MB/. Please note that the numbering 'system' used is actually Mayan-derived (though it's not base 20).

   (    /       ^        /    (
  ____   __   '_ _ _____/ __ ____ '
\)|_)_)\)| )  |(_(_|/   \)| )| ) )|
(_|    (_|         |\_/   |


--
#!/usr/local/bin/perl ########################################################### # # / ^ # __ _ _ _ _ __ ____ # | )(_(_|(_)\) : |_)/ # | ___| (_ | \_- # # ########################################################### %letter = ( '0' => " \n". "/\\\n". "\\/\n". " \n", '1' => " \n". "o\n". " \n". " \n", '2' => " \n". "o\n". "o\n". " \n", '3' => " \n". "o\n". "o\n". "o\n", '4' => "o\n". "o\n". "o\n". "o\n", '5' => "|\n". "|\n". "|\n". "|\n", '6' => " |\n". "o|\n". " |\n". " |\n", '7' => " |\n". "o|\n". "o|\n". " |\n", '8' => " |\n". "o|\n". "o|\n". "o|\n", '9' => "o|\n". "o|\n". "o|\n". "o|\n", '!' => " \n". " \n". "::\n". " \n", "\"" => "``\n". " \n". " \n". " \n", '.' => " \n". " \n". " : \n". " \n", '-' => " \n". "-\n". "-\n". " \n", ' ' => " \n". " \n". " \n". " \n", 'A' => " \n". "^\n". "|\n". " \n", 'B' => " \n". "____ \n" . "|_)_)\n". "| \n", 'C' => " \n". "_ _\n". "(_|\n". " |\n", 'CH' => " |\n". "_ |\n". "(_|\n". " \n", 'D' => " \n". "____ \n". "| ) )\n". "| \n", 'DH' => "| \n". "|___ \n". "| ) )\n". " \n", 'THE' => "| \n". "|___ \n". "| ) )\n". "| \n", 'E' => " \n". "'\n". "|\n". " \n", 'F' => "| \n". "|_ \n". "|_)\n". " \n", 'OF' => "| \n". "|_ \n". "|_)\n". "| \n", 'G' => " \n". "_ _ _\n". "(_(_|\n". " |\n", 'H' => " \n". "(\\ \n". " /)\n". " \n", 'I' => " \n". ".\n". "|\n". " \n", 'J' => " |\n". "_ _ |\n". "(_(_|\n". " \n", 'K' => " \n". "_ _\n". "(_|\n". " |\n", 'L' => " \n". "____\n". "/ \n". "\\_/ \n", 'M' => " \n". "____ \n". "|_)_)\n". " \n", 'MP' => " \n". "__ \n". "|_)\n". "|_ \n", 'MB' => " \n". "____ \n". "|_)_)\n". "|___ \n", 'N' => " \n". "____ \n". "| ) )\n". " \n", 'NK' => " \n". " _ _\n". " (_|\n". " _|\n", 'NG' => " \n". "_ _ _\n". "(_(_|\n". " ___|\n", 'O' => " _\n". "( \n". "| \n". " \n", 'OU' => " _ \n". "( )\n". " / \n". " \\ \n", 'P' => " \n". "__ \n". "|_)\n". "| \n", 'Q' => " \n". "___\n". "(_|\n". " |\n", 'R' => " \n". " \n". "\\)\n". "(_\n", 'S' => " /\n". "/ \n". "\\)\n". " \n", 'SH' => "/ \n". "\\)\n". "\\)\n". " \n", 'T' => " \n". "__ \n". "| )\n". "| \n", 'TH' => "| \n". "|_ \n". "| )\n". " \n", 'U' => "_ \n". " )\n". " |\n". " \n", 'V' => "| \n". "|___ \n". "|_)_)\n". " \n", 'W' => " \n". " _ \n". "(_)\n". " \n", 'X' => " \n". "_ _ \n". "(_| \n". " |)\n", 'Y' => " \n". "_ \n". "/)\n". " \n", 'Z' => " \n". "(\\\n". " /\n". "/ \n", ); %vow = ( 'A', '^', 'E', '/', 'I', '.', 'O', '(', 'U', ')'); while($msg = shift) { @out = (); $msg =~ tr/a-z/A-Z/; @msg = split('', $msg); $msg = join(':', @msg); # # do some grouping # $msg =~ s/O:U/OU/g; $msg =~ s/ :T:H:E: / :THE: /g; $msg =~ s/^T:H:E: /THE: /g; $msg =~ s/T:H/TH/g; $msg =~ s/D:H/DH/g; $msg =~ s/S:H/SH/g; $msg =~ s/C:H/CH/g; $msg =~ s/M:B/MB/g; $msg =~ s/M:P/MP/g; $msg =~ s/N:K/NK/g; $msg =~ s/N:G/NG/g; $msg =~ s/([AEIOU]):([BCDFGHJKLMNPQRSTVWXYZ])/$1$2/g; @msg = split(':', $msg); $vowel = 0; foreach $dude (@msg) { if ($letter{$dude}) # it's in the database { @l = split("\n", $letter{$dude}); for ($j = 0; $j < 4; $j++) { $out[$j] .= $l[$j]; } } elsif ($dude =~ /([AEIOU])([BCDFGHJKLMNPQRSTVWXYZ]+)/) # got a v +owel { @l = &vowelize($1, $2); for ($j = 0; $j < 4; $j++) { $out[$j] .= $l[$j]; } } } print "\n"; print join("\n", @out); print "\n"; } # # vowelize: superimpose a vowel mark over a consonant # sub vowelize { local($vowel, $consonant) = @_; $line = 0; @consonant = split("\n", $letter{$consonant}); $vowelMark = $vow{$vowel}; @oldline = split('', $consonant[$line]); splice(@oldline, 1, 1, $vowelMark); $consonant[$line] = join('', @oldline); return @consonant; }

Replies are listed 'Best First'.
Re: Tengwar
by Ovid (Cardinal) on May 05, 2004 at 18:56 UTC

    Boy does this bring back memories. In high school, we had a couple of teachers who would snatch up notes and read them aloud in class. A friend of mine and I learned how to write in Tengwar specifically to get around that.

    The sad thing is, I can still (mostly) write it :)

    Cheers,
    Ovid

    New address of my CGI Course.

      I have "Marillion" on my web site in Quenya using the tengwar. I learned to write it a couple years ago during the forming of my LOTR craze.

      Marillion means "son of pearl".

      _____________________________________________________
      Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
      s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

        Just a nit, but you don't "write in Tengwar." The word 'tengwar' roughly equates to the table of letters. That would be like saying you "write in Alphabet."

        You might say you write using the Feanorian characters, or if you're a true elf-nut, you might write in the Sindarin language (or some other dialect).

        It's nice to see that the Unicode has a code point for the Tengwar. I don't think it's really complete as Tolkien used quite a few characters not described in LotR appendices, but it's flattering to the fans that it was considered.

        --
        [ e d @ h a l l e y . c c ]

Re: Tengwar
by rje (Deacon) on May 05, 2004 at 19:32 UTC
    I noticed I didn't create mappings for /NG/ and /NK/. I think they would just be /G/ and /K/ with a 'floor':
      /NG/  /NK/
     _ _ _  _  _
     (_(_|  (__|
      ___|   __|
    
    
    Rob
      Did you update your post script with this?

      Your script doesn't work for tokens that evaluate to false (such as 0).

      A harder problem is how to handle command line input versus input from files, in a way that is simple for the user. I seem to be having problems with Windoze especially, but it could be I need $caffeine++ inserted.

      -QM
      --
      Quantum Mechanics: The dreams stuff is made of