Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Per::Critic

1 réponse
Avatar
kurtz le pirate
bonjour,

sur un forum, j'ai trouvé ce site <http://perlcritic.com/>.
un essai avec un de mes scripts donne (entre autre) cette analyse :



Expression form of "map" at line 36, column 11. See page 169 of PBP.
Severity: 4

mon code est le suivant :
...
0032: if( /^f/) {
0033: @line = split ' ';
0034: # remove first item : 'f'
0035: shift(@line);
0036: @temp = map ($_-1,@line);
0037: push @faces, [@temp];
0038: }
...

je ne comprends pas bien ce qui ne lui plait pas dans la ligne 36.
leur recommandation est :

"Write map { $_ =~ /$pattern/ } @list instead of map /$pattern/, @list"

j'aurais donc du écrire : @temp = map { $_-1 } @lines
c'est ça ?


merci
--
klp

1 réponse

Avatar
Emmanuel Florac
Le Sat, 04 Feb 2012 10:29:01 +0100, kurtz le pirate a écrit:


j'aurais donc du écrire : @temp = map { $_-1 } @lines c'est ça ?




Absolument. C'est la syntaxe moderne.

--
I am not a vegetarian because I love animals; I am a vegetarian
because I hate plants.
A. Whitney Brown