From perl to python
Question: 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.

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

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.


Answer: Your program is generating a script and running it.

A first python approximation is:

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

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.

