Re: [SSFR] défi perl |
[ Thread Index | Date Index | More debianworld.org/shellscript-fr Archives ]
Philippe Jacquot a écrit :
Que penses-tu de: my @tableau = ( { "cle1"=>"valeur1", "cle2"=>"valeur2" } , { "cle1"=>"valeur3", "cle2"=>"valeur4" } , { "cle1"=>"valeur5", "cle2"=>"valeur6" } ); foreach $tuple (@tableau) { while (($key, $val) = each(%$tuple)) { $$key = $val; } printf "cle1=%s, cle2=%s\n", $cle1, $cle2; } ? qui permet d'éviter le eval.
je répondais sur l'autre liste (celle avec une archive, de vraies dates et des messages entiers) :
use strict; use warnings; my @krishna = ( { host => 'www', user => 'mc' }, { host => 'mx', user => 'bob' } ); for ( @krishna ) { print "user : $$_{user} host : $$_{host} -- " } En pature au gestionnaire :The DCC Alliance is an association of organizations and individuals to assemble a common, standards-based core for Debian-based Linux distributions and accelerate worldwide commercial adoption of Debian GNU/Linux. While the DCC Alliance is an independent organization, we work closely with the Debian community in implementing common standards and enterprise features.
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |