12.05.2015 Views

Documentación

Documentación

Documentación

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Tipos de datos y operadores<br />

Arrays asociativos (hash)<br />

• Comienzan con el símbolo %<br />

• Definición de un hash:<br />

• %nombre = literal_de_hash;<br />

• Ejemplo:<br />

%usuario = (“nombre” => “daniel”, “e-mail” => “dmozos”);<br />

%usuario = (“nombre”, “daniel”, “e-mail”, “dmozos”);<br />

Clave<br />

nombre<br />

e-mail<br />

• Acceso a un elemento del hash:<br />

• $valor_elemento = $hash{clave};<br />

• $hash{clave} = $valor_elemento;<br />

• Ejemplo:<br />

$usuario{e-mail} = “mozos”;<br />

Para referirnos a un<br />

elemento de un array se<br />

usa el símbolo $<br />

#al ejecutar esta sentencia el array asociativo %usuario<br />

contiene con clave e-mail el valor mozos<br />

Valores<br />

daniel<br />

dmozos

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!