Thread abgedrehtes problem mit switch: oder bin ich blind? (71 answers)
Opened by deepblack at 2004-06-16 21:56

sri
 2004-07-03 20:13
#83462 #83462
User since
2004-01-29
828 Artikel
BenutzerIn
[Homepage] [default_avatar]
[quote=Dieter,03.07.2004, 12:32]
A "BEGIN" subroutine is executed as soon as possible, that is, the
moment it is completely defined, even before the rest of the containing
file is parsed. You may have multiple "BEGIN" blocks within a file--they
will execute in order of definition. Because a "BEGIN" block executes
immediately, it can pull in definitions of subroutines and such from
other files in time to be visible to the rest of the file. Once a
"BEGIN" has run, it is immediately undefined and any code it used is
returned to Perl's memory pool. This means you can't ever explicitly
call a "BEGIN".[/quote]
Bitte aktuelle doku benutzen!!!

Quote
A "BEGIN" code block is executed as soon as possible, that is, the moment it is completely defined, even before the rest of the containing file (or string) is parsed...

...These code blocks can be prefixed with "sub" to give the appearance of a subroutine (although this is not considered good style). One should note that these code blocks don't really exist as named subroutines (despite their appearance). The thing that gives this away is the fact that you can have more than one of these code blocks in a program, and they will get all executed at the appropriate moment. So you can't execute any of these code blocks by name....

...It should be noted that "BEGIN" code blocks are executed inside string "eval()"'s...
\n\n

<!--EDIT|sri|1088871271-->

View full thread abgedrehtes problem mit switch: oder bin ich blind?