[plug] Running a script to parse a script with args

Bernard Blackham bernard at blackham.com.au
Thu Aug 28 19:03:43 WST 2003


On Thu, Aug 28, 2003 at 03:29:42PM +0800, Trevor Phillips wrote:
> Ok, this is complicated/messy. Say I have a Perl script which parses a text 
> script/input and does things. I want to integrate a certain run of a set of 
> data. So, I can do that by having a text file with:
> 
>     #!/usr/bin/perl /my/perl/script
>     data....

Why don't you put "#!/usr/bin/perl" at the top of your perl script
and chmod +x it.

And then in your data file, use "#!/my/perl/script some args" on the
first line? (and of course tell your perl script to discard the
first line).

There's also the magic perl trick of embedding data & script in the
same file. eg:

---
#!/usr/bin/perl

while (<DATA>) { print; }

__DATA__
This is the data found by using <DATA>..
la
la
la


---

This may or may not be useful in your case though :)

HTH,

Bernard.

-- 
 Bernard Blackham 
 bernard at blackham dot com dot au



More information about the plug mailing list