From perl to python
<p>I've got some code that I've translated from perl into python, but I am having a time trying to figure out this last part. </p>

<pre><code>my $bashcode=&lt;&lt;'__bash__';
. /opt/qip/etc/qiprc;
. /opt/sybase/sybase.sh
perl -mdata::dumper -e 'print dumper \%env';
__bash__
my $var1;
eval qx(bash -c "$bashcode");
</code></pre>

<p>While I understand (a bit) what this is doing, I can't seem to find out how to do this in python. Any help would be greatly appreciated.</p>

<p>Your program is generating a script and running it.</p>

<p>A first python approximation is:</p>

<pre><code>import os
script=""". /opt/qip/etc/qiprc;
          . /opt/sybase/sybase.sh
          perl -mdata::dumper -e 'print dumper \%env';
"""
os.system(script)
</code></pre>

<p>As you can see, perl is still being used inside your script which is using the module data::dumper. If you want to use python here, you may need the equivalent module.</p>

python perl