Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Data files included in a package

by wufnik (Friar)
on Aug 28, 2003 at 19:35 UTC ( [id://287501]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://287501]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-03-28 20:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found