Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
XTRAIL
/
andre
/
PERL
:
expression.pl.bak
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
#!/usr/bin/perl use OLE; use Spreadsheet::WriteExcel; @tablo = ("Barney", "Homer", "Marge", "Bart", "Lisa", "Maggie", "Moe", "Flanders"); @table = (); $table[0]='3trois'; $table[1]='1un'; $table[2]='2deux'; $table[3]='4quatre'; @tri=sort(@table); print $tri[0]; print "\n"; print $tri[1]; print "\n"; print $tri[2]; print "\n"; print $tri[3]; print "\n"; $taille=@table; print "le tableau comporte $taille cases \n"; excel(); ############################################################## sub excel { $xl_file ="i:\\workarea\\perl\\test.xls"; # OLE - Excel Connexion # Creation d'un objet OLE - Pointeur d'application Excel $xl_appli = CreateObject OLE 'Excel.Application' || die $!; # param�trage # 0 = non visible # 1 = visible $xl_appli->{'visible'} = 0; # ouvre un fichier Excel $workbook = $xl_appli->Workbooks->Open($xl_file); # active la feuille de travail $worksheet = $workbook->Worksheets(1); # revoie des valeurs $cellA2 = $worksheet->Range("A2")->{'Value'}; $cellB1 = $worksheet->Range("B1")->{'Value'}; #print $cellA2 . $cellB1; @cell = (); my $array = $worksheet->Range("A1:A10")->{'value'}; foreach my $ref_array (@$array) { foreach my $scalar (@$ref_array) { print "$scalar\t"; } print "\n"; } # fermeture $xl_appli->ActiveWorkbook->Close(0); $xl_appli->Quit(); } ############################################################## sub recherche { print "Quel nom voulez-vous rep�rer ?\n"; $nom = <stdin>; chomp $nom; for ($i=0; $i<@tablo; $i++){ if($tablo[$i] =~ /$nom/){ print "$nom est en position $i\n"; } } $chaine = "L'�ge du capitaine est de 28 ans."; if($chaine =~ /\d+/){ print "L'�ge est $& ans\n"; } } ##############################################################