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/06/12 14:56] 104.255.179.6 old revision restored (2026/06/04 20:52) |
notes:perl_cheat_sheet [2026/06/13 14:55] (current) 47.245.90.216 old revision restored (2026/06/04 13:11) |
||
|---|---|---|---|
| Line 14: | Line 14: | ||
| * Parenthesis are optional unless part of syntax. | * Parenthesis are optional unless part of syntax. | ||
| * '' | * '' | ||
| - | * '' | ||
| ===== Numbers ===== | ===== Numbers ===== | ||
| Line 62: | Line 61: | ||
| * 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 an arrow (a fat-comma), simple keys don't have to be quoted (barewords) . | ||
| ===== Control Structures ===== | ===== Control Structures ===== | ||
| Line 100: | Line 90: | ||
| * ''<>'' | * ''<>'' | ||
| chomp; | chomp; | ||
| - | print LOGFILE | + | print "It was $_ that I saw!\n"; |
| }</ | }</ | ||
| * '' | * '' | ||
| Line 112: | Line 102: | ||
| open BEDROCK, '> | open BEDROCK, '> | ||
| open LOG, '>>: | open LOG, '>>: | ||
| - | open my $bedrock, '>: | + | open BEDROCK, '>: |
| binmode STDOUT, ': | binmode STDOUT, ': | ||
| - | * '' | ||
| ===== User Subroutines ===== | ===== User Subroutines ===== | ||