Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Nächste Überarbeitung Beide Seiten der Revision | |||
perl_array_of_hashes [2018/12/20 10:07] admin angelegt |
perl_array_of_hashes [2018/12/20 10:16] admin [Array of Hashes] |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== Array of Hashes ====== | ====== Array of Hashes ====== | ||
+ | ===== Erstellung eines "Array of Hashes" ===== | ||
+ | <code bash> | ||
+ | @AoH = ( | ||
+ | { | ||
+ | husband => "barney", | ||
+ | wife => "betty", | ||
+ | son => "bamm bamm", | ||
+ | }, | ||
+ | { | ||
+ | husband => "george", | ||
+ | wife => "jane", | ||
+ | son => "elroy", | ||
+ | }, | ||
+ | |||
+ | { | ||
+ | husband => "homer", | ||
+ | wife => "marge", | ||
+ | son => "bart", | ||
+ | }, | ||
+ | ); | ||
+ | </code> | ||
+ | Hinzufügen eines hash zum array: | ||
+ | <code bash> | ||
+ | push @AoH, { husband => "fred", wife => "wilma", daughter => "pebbles" }; | ||
+ | </code> | ||
===== Quellen ===== | ===== Quellen ===== | ||
* O'REILLY - Programming Perl (https://docstore.mik.ua/orelly/perl4/prog/ch09_03.htm) | * O'REILLY - Programming Perl (https://docstore.mik.ua/orelly/perl4/prog/ch09_03.htm) |