A
Alextophi
*-* I must find for a number '$day' the day or the days of the table
%day_array:
my $day = 4;
my %day_array = ("1" => "0", # Dimanche
"2" => "1", # Lundi
"4" => "2", # Mardi
"8" => "3", # Mercredi
"16" => "4", # Jeudi
"32" => "5", # Vendredi
"64" => "6" # Samedi
);
my $New_day = $day_array{$day}; # result : $New_day = 2
*-* problem: how to make if $day = 5 or 11 or another ?
5 = 4+1 # result 2 et 0
11 = 8+2+1 # result 3 et 1 et 0
it is a big problem!
thank you
Christophe.
%day_array:
my $day = 4;
my %day_array = ("1" => "0", # Dimanche
"2" => "1", # Lundi
"4" => "2", # Mardi
"8" => "3", # Mercredi
"16" => "4", # Jeudi
"32" => "5", # Vendredi
"64" => "6" # Samedi
);
my $New_day = $day_array{$day}; # result : $New_day = 2
*-* problem: how to make if $day = 5 or 11 or another ?
5 = 4+1 # result 2 et 0
11 = 8+2+1 # result 3 et 1 et 0
it is a big problem!
thank you
Christophe.