This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
notes:perl_cheat_sheet [2026/11/02 09:10] 191.242.44.87 old revision restored (2026/08/06 06:49) |
notes:perl_cheat_sheet [2026/11/03 05:52] (current) 37.122.152.241 old revision restored (2026/08/06 11:23) |
||
|---|---|---|---|
| Line 62: | Line 62: | ||
| * List functions may return different scalars - array variables return number of elements. The '' | * List functions may return different scalars - array variables return number of elements. The '' | ||
| + | ===== Hashes ===== | ||
| + | |||
| + | * A hash is a list indexed by a string (key) - a collection of key-value pairs. '' | ||
| + | * Uses scalable, efficient algorithms. Used to be called associative arrays. | ||
| + | * '' | ||
| + | * Assigning a hash to an array unwinds (flattens) it. | ||
| + | * To initialize a hash :<code perl> | ||
| + | %some_hash = ( ' | ||
| + | * When using a big arrow (a fat-comma) or when accessing a value, simple keys don't have to be quoted (barewords) e.g. <code perl> | ||
| + | * '' | ||
| ===== Control Structures ===== | ===== Control Structures ===== | ||
| Line 103: | Line 113: | ||
| open BEDROCK, '> | open BEDROCK, '> | ||
| open LOG, '>>: | open LOG, '>>: | ||
| - | open BEDROCK, '>: | + | open my $bedrock, '>: |
| binmode STDOUT, ': | binmode STDOUT, ': | ||
| + | * '' | ||
| ===== User Subroutines ===== | ===== User Subroutines ===== | ||