hi all, i've a requirement like this.
i want to access the contents of an array declared in one script,which is a bash script, to a second script which is a perl script.
actually i want a sort of global variable which can be accessed in other script
like environmen variables and also i can unset them whenever i need!!
plz help me...
thanks in advance..
regards..
perl has a builtin hash containing shell variables. you can access anything in the parent shell like so
# for a shell variable named 'VAR' the value of '$VAR' is accessed thusly:
$ENV{'VAR'};
thanx varontron !! but my actual problem is stated below!!
here is the script sample1.sh
#!/bin/bash
tab=$1;
declare -a ${tab}_fld;
for((i=1;i<=4;i++))
do
echo -n "enter ${tab}_fld[$i] :";read ${tab}_fld[$i];
done
eval echo \${${tab}_fld[3]};
export ${tab}_fld;
export tab;
perl -e '
$tab="$ENV{'tab'}"."_fld";
print ("$tab\n");
print ("env: $ENV{'"$tab[3]"'} \n");
'
$ ./sample1.sh hell
enter hell_fld[1] :1
enter hell_fld[2] :2
enter hell_fld[3] :3
enter hell_fld[4] :4
3
syntax error at -e line 4, near "hell["
Execution of -e aborted due to compilation errors.
i want to access the 'hell_fld' array declared above.
infact, i want access the array in sample1.sh through another script like ..
#!/usr/bin/perl
$tab="$ENV{'tab'}"."_fld";
print ("$tab\n");
print ("env: $ENV{'"$tab[3]"'} \n");
is there any way to make this possible? plz help.
thanx!!
no replies yet.....plz help somebody.