Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

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.


In reply to Re: Re: Re: Re: International Perl Resources by mirod
in thread International Perl Resources by Lexicon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (10)
    As of 2014-12-22 22:14 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (132 votes), past polls