www.farid-hajji.net banner

Farid Hajji

Perl: Einführung, Anwendungen, Referenz (2/e) [Support-Site]

Farid Hajji: Perl - Einführung, Anwendungen, Referenz
2., aktualisierte und erweiterte Auflage
Addison-Wesley Longman, ISBN 3-8273-1535-2

Kapitel 10: Kontrollstrukturen und Programmfluß

Inhalt
Synopsis
undef, 0, '0', '', ()                   # Falsche Werte

$a && $b, $a || $b, $a ^ $b, !$a        # und oder xor nicht: Stark
$a and $b, $a or $b, $a xor $b, not $a  # schwache Bindung

open (IFILE, "< /not/there") or die '...';  # Shortcut-Verhalten
prepare_arguments() and use_arguments();    # Shortcut-Verhalten

{ # Das ist ein Block }
code1; code2; code3;                     # Sequenz von Anweisungen
$result = code1, code2, code3            # Der Kommaoperator

$result = $condition ? $true_expr : $false_expr;  # Ternärer Operator
if (Condition) { ... }
if (Condition) { ... } else { ... }
if (Condition) { ... } elsif { ... } else { ... }

Code if Condition;
Code unless Condition;
do { Block } if Condition
do { Block } unless Condition

&$dispatcher{$function_name}($funcarg1, $funcarg2);

foreach $key ( @list ) { ... }
for $key ( @list ) { ... }
for (init; condition; increment) { ... }
while (Condition) { ... }
until (Condition) { ... }
do { ... } while (Condition);
do { ... } until (Condition);
while ( Condition ) { ... last if Cond2; ... }
while ( Condition ) { ... next if Cond2; ... }
while ( Cond-with-Sideeffects ) { ... redo if Cond; ... }
while ( ... ) { ... } continue { ... }
code while (...);    # Minischleife
code until (...);    # Minischleife

@selected = grep { Selektor-Ausdruck }     @input;
@transfmd = map  { Transformer-Ausdruck  } @input;

$oneline  = <STDIN>;   # skalarer Kontext
@alllines = <STDIN>;   # Listenkontext
Beispielprogramme
miniloop.pl Minischleife mit while: Erste Entity-Zeile
perl-eval-shell.pl Eine primitive Perl-Shell mit eval()
Ergänzungen
Lösungen zu ausgewählten Übungsaufgaben

In Vorbereitung

FAQ

In Vorbereitung

Errata
Errata, 1. Nachdruck

[Prev] [Up] [Next]

[Alte Quelle]


Last modified: $Date: 2006/05/18 12:55:43 $
FH. Search :: Sitemap :: Disclaimer :: Copyright :: Privacy
FreeBSD Logo