Friday, December 19, 2008

__END__

Perl defines several interesting special internal values, one of which is the aptly named __END__.

The __END__ special value denotes the logical "end of file" for your program to the Perl interpreter. Everything that follows this special constant is treated as data and may be read via the filehandle.

This terrific feature provides developers with a nice place to put test data, provide configuration information for your program, or even place your POD!

#!c:\perl\bin\perl.exe -w
# perl-test-end.pl
use strict;

while ( ) {
print;
}


__END__
first data line
second data line


c:\perlscripts\perl.exe perl-test-end.pl
first data line
second data line

No comments: