
Sometimes you want to include data in a perl script and not want to include the data within the code itself. With perl, you can do this by using the __END__ label and reading the data in via the DATA filehandle. For example:
#!/usr/bin/perl
while ($line = <DATA>)
{
chomp $line;
push (@whoishere, $line);
}
for ($i = 0; $i <= $#whoishere; $i++)
{
print "$whoishere[$i] is at line #$i\n";
}
__END__
you
me
us
them
will print out:
you is at line #0
me is at line #1
us is at line #2
them is at line #3
© 2010–2011 Crumpeta Consulting LLC.