You have to find a way to pass the *value* of the variable from Perl to the shell.
The way via command-subsitution I showed above is one way to do this.
Perl prints the value to STDOUT and the shell reads it into a shell-variable (which is different from the perl-variable).
Now if you have the perl-script directly embedded in your shell-script as a here-doc then you will have all sorts of problems properly escaping stuff, which is why I suggested above that you put all the Perl-code into a script of it's own that you can call anything you like - I called it simply "script.pl" for illustration but what you have to do is to move the perl-code from the shell-script into a perl-script file and call that file via command-substitution.
In reply to Re^7: pass perl variable to shell script
by morgon
in thread pass perl variable to shell script
by arthurs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |