http://qs321.pair.com?node_id=287501


in reply to Data files included in a package

hola;

i have always found
__DATA__
to be useful for including data within scripts/modules;
simple scenario:

you want to use 'test' data if a file is not specified.
my @lines # where we want to store the data my $testfile = shift; # populate lines in dull bit here if testfile is a file chomp (@lines = (<DATA>)) unless -f $testfile; print join " * ", @lines; __DATA__ in the world of the mules there are no rules
hope that helps,

...wufnik

Replies are listed 'Best First'.
Re: Re: Data files included in a package
by Zaxo (Archbishop) on Aug 29, 2003 at 06:43 UTC

    wufnik++. Note that only the last __DATA__ section read in a namespace is visible. Be aware that __END__ sections are always in package main::.

    After Compline,
    Zaxo