Bonjour,
J'essaie d'apprendre Perl avec le livre :
Learning Perl, 4th Edition
By brian d foy, Tom Phoenix, Randal L. Schwartz
...............................................
Publisher: O'Reilly
Pub Date: July 2005
ISBN: 0-596-10105-8
Pages: 312
Un des exemples est :
Pourquoi on a :Code:
1
2
3
4
5
6
7
8
9
10
11 sub max { my($max_so_far) = shift @_; # the first one is the largest yet seen foreach (@_) { # look at the remaining arguments if ($_ > $max_so_far) { # could this one be bigger yet? $max_so_far = $_; } } $max_so_far; }
Ne devrait-on pas avoir :Code:my($max_so_far) = shift @_;
my($max_so_far) annonce dans ce cas une liste, or on veut récupérer le 1er élement, c'est donc un scalaireCode:my $max_so_far = shift @_;
Merci d'avance
