[Toulouse-pm] split

Michel Rodriguez mrodrigu at ieee.org
Thu Jan 16 08:50:01 CST 2003


On Thu, 16 Jan 2003 eric.vernichon.ev at borchers.fr wrote:

> Pourquoi si je fais
>
> $_=  "deb.fin";
> ($debut,$fin)=split (/./);
> print "debut : $debut";
> print "fin : ".$fin;
>
> $debut ne contient pas  deb et $fin ne contient pas fin ?

Parce que quand tu ecris split /./ tu splite sur une expression reguliere
(note que meme si tu ecris split "." ou split '.' tu splite sur une
regexp), donc le . est une wild-card. split /\./ marchera mieux.

Michel Rodriguez
Perl & XML
http://www.xmltwig.com





More information about the Toulouse-pm mailing list