converting perl regular expressions to python
<p>I'm trying to change some lines of perl to python and I'm struggling to understand
what's going on in the perl code. Any help would be greatly appreciated.</p>

<p>thanks!</p>

<pre><code>    my($junk1, $filename, $junk2) = $mydir =~ m/(.*\\)(.*\\)(.*)/;
    $filename =~ s/\\//;
        print $out $filename, "\n"; 
</code></pre>
