Thread Hat Perl events?
(12 answers)
Opened by bianca at 2021-10-27 09:35
Hier noch mal ein Code-Beispiel dazu:
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 #!/usr/bin/perl use warnings; use strict; sub func1 { my $back = shift; if ($back == 1) { print "\$back is true.\n"; return 0; } print "Doing something else.\n"; } sub controlBack { my $count = shift; if ($count < 10) { return 0; } else { return 1; } } # Defining start-settings for MainLoop: my $running = 1; my $count = 0; my $back = 0; # Running the MainLoop: while ($running) { $back = controlBack($count); func1($back); $count++; if ($count > 20) { $running = 0; } } print "Program ends.\n"; |