|We don't bite newbies here... much|
Speaking as someone who has written a compiler before. Let me point you in the direction that you need to be going.
1. You are not going to do this in PERL, you will rot your brain and go through WAYYY more frustration than is necessary trying to do so. There is already a REALLY nice suite of tools for writing compilers in C. PERL isn't written in PERL ;-)
2. The first tool you will want to learn about is LEX. Lex generates lexical analyzers.
3. The second tool that you will want to learn to use is YACC (or Bison). Bison will allow you to form the proper grammars for your language, to write the semantic analyzer, and to allow you to generate intermediate code. Intermediate code will be one of the key factors in making your compiler cross platform. You might even consider bootstrapping whatever you write to GCC, so as to to make this system cross platform that way, it will save you a lot of headaches, as you will not have to re-release for every platform.
4. These 2 tools are generally used with C. They generate sources that can be linked to each other and to your own source.
5. If you don't know anything about grammars and automata, you can forget about writing a compiler. Read up on them.
6. A textbook that you might use to get yourself started is Compilers: Principals, Techniques, and Tools by Aho, Sethi, and Ullman.
Just Another Perl Backpacker