Stuart White wrote:

> This was my first chance at testing this, and it did
> work.  How, I'm not sure though.
> Specifically:
>
> What do you call the "PRIMES:" and "__END___" syntax?

The two are not directly related.  The way PRIMES is used here makes it a
label.  This allows rapid, uncomplicated iteration through the outer list if
$possible_prime is evenly divisible by, and thus has modulus zero in relation
to, $test;

The __END__ syntax, on the other hand, tells the Perl interpreter tthat the end
of profram code has been reached for the file.  It can be useful if the code
section is followed by either documentation or data.  With documentation, it
prevents the interpreter from taking the text as code.  If you have a reference
to <DATA>, Perl will also look in the section following __END__ or __DATA__ for
the data to be processed.

Greetings! E:\d_drive\perlStuff>perl -w
while  (<DATA>) {
   print;
}

__END__
Hello
Hello
Goodbye
Goodbye
^Z

I just checked, and this is special magic with the __END__ and __DATA__ tags.
For instance:

Greetings! E:\d_drive\perlStuff>perl -w
while  (<DATA>) {
   print;
}

__JABBERWOCK__
Hello

Does not work, as we can see.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to