Perl question: passing in variables

Vaughn Treude vltreude at deru.com
Fri Jul 6 14:08:42 MST 2007


Quick perl question:
I'm trying to run a perl script that is executable; that is, the file 
has "x" permission and starts with this line:

#!/usr/bin/perl -w

There's a parameter in this script that's not defined by default, for 
example

my $foo; # no default

If foo is not set, the script exits with an error.  Normally I would 
just modify the script but this script gets extracted from a shell 
script that has the perl script and an rpm embedded in it.  (How they 
did that I don't know.)  So I would expect there's a way to do this, but 
there were  no help files with the script.

The shell script invokes the install file like this:
./install_script *$

So I know that I can pass one or more arguments to the outer shell 
script and they will get passed verbatim to the perl script.

Is there a to pass a value for foo into the script without modifying the 
script?

Thanks in advance,
Vaughn


More information about the PLUG-discuss mailing list