2012-06-27 21:33:44 +02:00
|
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
2012-06-27 21:42:23 +02:00
|
|
|
|
use 5.16.0;
|
|
|
|
|
|
2012-06-27 21:33:44 +02:00
|
|
|
|
# Exercices tableaux
|
2012-06-27 21:42:23 +02:00
|
|
|
|
my @alphabet = ("a" .. "z");
|
|
|
|
|
my @cartes = ("01".."10","valet","dame","roi");
|
|
|
|
|
my @annee=("a1","a2","lp");
|
|
|
|
|
my @promo=@annee;
|
|
|
|
|
my @tout = (@alphabet , "trucmachin" , @cartes , 1145, "\n");
|
2012-06-27 21:33:44 +02:00
|
|
|
|
|
|
|
|
|
print @tout;
|
|
|
|
|
|
|
|
|
|
# Autre exercice
|
|
|
|
|
|
2012-06-27 21:42:23 +02:00
|
|
|
|
my @jours=("Lundi","Mardi","Mercredi");
|
2012-06-27 21:33:44 +02:00
|
|
|
|
|
2012-06-27 21:42:23 +02:00
|
|
|
|
# explicite
|
|
|
|
|
#foreach $jours(@jours)
|
|
|
|
|
#{
|
|
|
|
|
# print $jours."\n";
|
|
|
|
|
#}
|
2012-06-27 21:33:44 +02:00
|
|
|
|
|
2012-06-27 21:42:23 +02:00
|
|
|
|
say foreach @jours ;
|
2012-01-05 12:02:51 +01:00
|
|
|
|
|
2012-06-27 21:33:44 +02:00
|
|
|
|
# Perl : les nombres : < > <= >= == !=
|
|
|
|
|
# Chaînes : lt gt eq ne
|
|
|
|
|
|
|
|
|
|
# !~ et =~ sont des opérateurs d'appartenance
|