Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: Re: Re: International Perl Resources

by mirod (Canon)
on Jan 31, 2001 at 03:22 UTC ( [id://55392]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: International Perl Resources
in thread International Perl Resources

Easy, you can write this (from the Camel 3 p. 280):

#!/bin/perl -P #include "./francais.h" utilise strict; utilise Data::Dumper; mon %hdh; # mes, ma and mon are all like my tant_que (<>) { suivant sauf_si( r/^(.*?):\e*//); # r -> remplacer \e -> espace mon FFqui=FF1; # I do not have the Euro sign on m +y # keyboard so I used F(rench) F(ra +nc) pour mon FFchamp( separe) { mes( FFclef, FFvaleur)= separe /=/, FFchamp; FFhdh{FFqui}{FFclef}= FFvaleur; } } imprime Dumper( %hdh);

Of course you need a francais.h file

#define utilise use #define mon my #define ma my #define mes my #define tant_que while #define sauf_si unless #define separe split #define suivant next #define imprime print #define ouvre open #define meurt die #define pour for #define ou or #define execute() \ while( <DATA>) \ { $programme .= $_; } \ $programme=~ s{FF}{\$}g; \ $programme=~ s{r/}{s/}g; \ $programme=~ s{\\e}{\\s}g; \ eval( $programme) or die $@; execute(); __DATA__

And then you can run it using an input file such as:

pierreafeux: mari=frederic ami=barnabe femme=wilma animal_de_companie= +dino simpson: mari=omer femme=marjorie enfant=barthelemie dupont: mari=jean femme=marie enfant=pierre animal_de_companie=me +dor

You will need to make this file executable, or run it with perl -P as you can't do just perl <file> and have the -P on the command line take-over properly.

And I know it is not robust, especially the quick hacks to French-ize the regexp, ask Damian if you want a real French module!

Update: I removed the display of the program and moved the execute(); call to the included file, it looks better now.

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: International Perl Resources
by jlawrenc (Scribe) on Mar 25, 2001 at 20:59 UTC
    Brilliance!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://55392]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-12-09 22:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which IDE have you been most impressed by?













    Results (55 votes). Check out past polls.