<?xml version="1.0" encoding="windows-1252"?>
<node id="55392" title="Re: Re: Re: Re: International Perl Resources" created="2001-01-30 22:22:18" updated="2005-08-15 10:23:10">
<type id="11">
note</type>
<author id="9346">
mirod</author>
<data>
<field name="doctext">
&lt;p&gt;Easy, you can write this (from the Camel 3 p. 280):&lt;/p&gt;
&lt;code&gt;
#!/bin/perl -P
#include "./francais.h"

utilise strict;
utilise Data::Dumper;

mon %hdh;                           # mes, ma and mon are all like my

tant_que (&lt;&gt;) {
  suivant sauf_si( r/^(.*?):\e*//); # r -&gt; remplacer \e -&gt; espace
  mon FFqui=FF1;                    # I do not have the Euro sign on my 
                                    # keyboard so I used F(rench) F(ranc)
  pour mon FFchamp( separe) {           
    mes( FFclef, FFvaleur)= separe /=/, FFchamp; 
  FFhdh{FFqui}{FFclef}= FFvaleur;  
  }
}
imprime Dumper( %hdh);
&lt;/code&gt;
&lt;p&gt;Of course you need a &lt;tt&gt;francais.h&lt;/tt&gt; file&lt;/p&gt;
&lt;code&gt;#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( &lt;DATA&gt;)                 \
  { $programme .= $_; }        \
$programme=~ s{FF}{\$}g;       \
$programme=~ s{r/}{s/}g;       \
$programme=~ s{\\e}{\\s}g;     \
eval( $programme) or die $@;   

execute();
__DATA__
&lt;/code&gt;
&lt;p&gt;And then you can run it using an input file such as:&lt;/p&gt;
&lt;code&gt;
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=medor
&lt;/code&gt;
&lt;p&gt;You will need to make this file executable, or run it with &lt;tt&gt;perl -P&lt;/tt&gt;
   as you can't do just &lt;code&gt;perl &lt;file&gt;&lt;/code&gt; and have the &lt;tt&gt;-P&lt;/tt&gt;
   on the command line take-over properly.&lt;/p&gt;
&lt;p&gt;And I know it is not robust, especially the quick hacks
   to French-ize the regexp, ask Damian if you want a real
   &lt;tt&gt;French&lt;/tt&gt; module!&lt;/p&gt; 
&lt;p&gt;&lt;b&gt;Update&lt;/b&gt;: I removed the display of the program and 
   moved the &lt;tt&gt;execute();&lt;/tt&gt; call to the included file,
   it looks better now.&lt;/p&gt;</field>
<field name="root_node">
55176</field>
<field name="parent_node">
55366</field>
</data>
</node>
