use strict; use utf8; use Encode;

open FILE, "<intranet.csv"; my @intranet=<FILE>; close FILE;

foreach my $line (@intranet) { my($prenom,$nom,$tel,$cphone,$poste,$email,$job,$service)=split /;/, $line; my $id=(split /@/, $email)[0]; print "inserting $id\n"; chop $service; if($cphone eq "") { $cphone=" "; } dsadd ou \&quot;OU=MaComp,DC=france,DC=Compagnie,DC=com\&quot;;

dsadd ou \&quot;OU=$service,OU=MaComp,DC=france,DC=Compagnie,DC=com\&quot;\ -desc \&quot;$service Team\&quot;;

dsadd user \ \&quot;CN=$prenom $nom,OU=$service,OU=MaComp,DC=france,DC=Compagnie,DC=com\&quot;\ -fn \&quot;$prenom\&quot; \ -ln \&quot;$nom\&quot; \ -upn \&quot;$id\@france.Compagnie.com\&quot; \ -display \&quot;$prenom $nom\&quot; \ -tel \&quot;$tel\&quot; \ -email \&quot;$email\&quot; \ -dept \&quot;$service\&quot; \ -company \&quot;Ma Compagnie France\&quot; \ -mustchpwd yes \ -samid \&quot;$id\&quot; \ -office \&quot;France\&quot; \ -title \&quot;$job\&quot; \ -mobile \&quot;$cphone\&quot; \ -desc \&quot;Ma Compagnie France\&quot; \ -disabled no; }