It took a long time to reach the info below.. I think it could have documented better in official page of the module..
#nginx.conf
set $variable_name "xxxx";
#perl
my $value = $r->variable('variable_name');
#nginx.conf
set $variable_name "xxxx";
#perl
my $value = $r->variable('variable_name');