There are a variety of ways, depending on your goal. Here's one way (minus error checking and meta-character escaping):
$ cat script1.pl #!/usr/bin/perl # script1.pl my $name = '123abc'; my $results = `./script2.pl "$name"`; # $results now contains the output of script2.pl $ cat script2.pl #!/usr/bin/perl # script2.pl # run locate on the first argument given to this script print `locate "$ARGV[0]"`;
Aaron B.
Available for small or large Perl jobs; see my home node.
In reply to Re: Use a Variable in a Separate Perl Script
by aaron_baugher
in thread Use a Variable in a Separate Perl Script
by NinjaOne
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |