OK, so let's clarify: Since you have two completely unrelated processes (unrelated from the Perl- OS-viewpoint), it doesn't make sense to talk about "one script
refering to a variable in another script". However, it makes sense to
pass a value to the other script. Now, your case is a bit more complicated because you don't execute the other script directly, but have a bash process in between.
Of course, this bash process is unnecessary, if all it does is to do a chdir. You can do the chdir in Perl as well (see chdir). However, if you expect that this intermediate bash script later will do additional stuff, which you, for whatever reason, would prefer implementing in bash, it would make sense to stick with that.
As for passing the value of your variable to the other script, you have several options. Since in your case, the value is only a fairly short string, I would consider two possibilities: Pass them as a parameter to your bash script, which then hands it over as a parameter to your Perl script; or use an environment variable to pass the information.
The latter solution is faster (simpler) to implement, but the former one is, IMO, cleaner.
--
Ronald Fischer <ynnor@mm.st>