Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1073 connectés 

  FORUM HardWare.fr
  Programmation
  Perl

  Lecture tableau associatif complexe

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Lecture tableau associatif complexe

n°836308
jeh_
Posté le 30-08-2004 à 11:38:16  profilanswer
 

Bonjour,
 
Pourriez-vous m'indiquer la manière d'accéder à la clé 'operation'("sous" clé de 'child_command') par exemple dans la table suivante :  
 
$VAR1 = { 'configuration' => '', 'result' => 1, 'state' => 3, 'operation' => '*NORTEL_CREATION_PVC', 'report' => '/report/configuration/PE-11528/PE-11528/report11288.html', 'child_commands' => [ { 'configuration' =>   '/produced_conf/PE-11268/PE_transmission_interface-12344/conf11289.txt', 'result' => 1, 'state' => 3, 'operation' => 'NORTEL_CREATION_DLCI', 'report' => '/report/configuration/PE-11268/PE_transmission_interface-12344/report11289.html', 'child_commands' => [], 'command_id' => 11289 } ], 'command_id' => 11288 };  

mood
Publicité
Posté le 30-08-2004 à 11:38:16  profilanswer
 

n°836427
burgergold
5$? va chez l'diable!
Posté le 30-08-2004 à 13:25:07  profilanswer
 

essaye ca
$foo{'operation'}->[0]->{'operation'}

n°836469
jeh_
Posté le 30-08-2004 à 13:57:46  profilanswer
 

tu veux dire  :  
$foo->{'child_commands'}->[0]->{'operation'} ?
ça ne fonctionne pas.
J'ai également essayé : $foo->{'child_commands'}->{'operation'} mais ça ne fonctionne pas non plus...

n°836508
burgergold
5$? va chez l'diable!
Posté le 30-08-2004 à 14:14:45  profilanswer
 

nah j'ai bien dit:
 
$foo{'operation'}->[0]->{'operation'}
 
à moins que ton hash ne soit une référence mais c'est pas le cas

n°836526
pospos
Posté le 30-08-2004 à 14:22:09  profilanswer
 

bizarre ton histoire, chez moi ca marche:

Code :
  1. $VAR1 = { 'configuration' => '', 'result' => 1, 'state' => 3, 'operation' => '*NORTEL_CREATION_PVC', 'report' => '/report/configuration/PE-11528/PE-11528/report11288.html', 'child_commands' => [ { 'configuration' =>   '/produced_conf/PE-11268/PE_transmission_interface-12344/conf11289.txt', 'result' => 1, 'state' => 3, 'operation' => 'NORTEL_CREATION_DLCI', 'report' => '/report/configuration/PE-11268/PE_transmission_interface-12344/report11289.html', 'child_commands' => [], 'command_id' => 11289 } ], 'command_id' => 11288 };
  2. print $VAR1->{child_commands}->[0]->{operation};


Message édité par pospos le 30-08-2004 à 14:22:20
n°836666
jeh_
Posté le 30-08-2004 à 15:28:37  profilanswer
 

ça y est, j'ai trouvé :  
$result->{'child_commands'}[0]->{operation}
Mon hash est effectivement une référence.
 
Merci de vous être penchés sur mon problème.
@ ++

n°836847
pospos
Posté le 30-08-2004 à 17:08:08  profilanswer
 

$result->{child_commands}[0]->{operation}  
<=>
$result->{child_commands}->[0]->{operation}  
<=>
$result->{child_commands}->[0]{operation}
<=>
$result->{child_commands}[0]{operation}
 
(et avec ou sans guillemets...)


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Perl

  Lecture tableau associatif complexe

 

Sujets relatifs
Tableau Array [JS]pointer un element d'un tableau
IE garder la mise en forme du texte dans un tableau[odbc jdbc] lecture base dBase (.dbf)
PHP recuperer les dimensions d'un tableau en HTML[DHTML] Tableau dynamique
tableau croisé dynamique access[C] affectation de tableau à 2 dim
Afficher tableau case par caseprobleme tableau
Plus de sujets relatifs à : Lecture tableau associatif complexe


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR