|No such thing as a small change|
Re: I'm trying to get a numeric arrayby Athanasius (Canon)
|on Sep 03, 2012 at 14:11 UTC||Need Help??|
Hello, fatmac, and welcome to the Monastery!
As you’ve no doubt found, typing in test data from the console quickly becomes tedious when you’re developing a script. What you need is a way to input data from the script itself but using the same syntax you would use for reading from the console (or from a separate data file). In Perl, that way is provided by the DATA filehandle, which reads input from the bottom of the script file beginning immediately after a line consisting of the __DATA__ token. The following script (which incorporates much of the advice of Gangabass and philiprbrenan, above) illustrates the use of DATA:
When you’re finished testing, and want to use the script to input data from the console, simply change the line
and you’re there!
Hope that helps,
Athanasius <°(((>< contra mundum