Perl variables
When a perl script exits, all the variables associated with it are lost. Is there a way of saving these variables for access by other scripts ?
|
in what sense do you want these accessible? you can always do something like using Data::Dumper to print out any data structures to a file to read later... if you want a more temporary method on only a couple of variables, try exporting them to bash
|
Since you can only export to subsequent shells, here are some things to look at:
1. Source the script instead of having a separate shell execute it. i.e. . scriptname 2. Have your script run the command that needs the environment variables 3. Save the value of the variable to a file and then read the file in the previous script using: var=`cat filename` This would be cumbersome if multiple people were running the script because the filename would need to be unique for a user. |
All times are GMT -5. The time now is 05:17 AM. |