title: call python script and store return value in perl
body: <p>I have a perl script in which I am calling python script through system command which is in some another location.</p>
  
  <p>Perl script part where it calls python script </p>
  
  <pre><code>$path=system("C:\\FindPath\\find_path_location.py", $ID);
  print $path;
  </code></pre>
  
  <p>The python script takes the argument $ID, does some processing and generate a path which is stored in variable path1. I want to use the value of "path1" in my perl script</p>
  
  <p>find_path_location.py</p>
  
  <pre><code>def main(argv=sys.argv[1:]):
      *function execution*
      path1 = *some path which is generated*
      print "{0}".format(path1)
      return path1
  
  
  if __name__ == '__main__':
      startTime = time.time()
  
      try :
          main()
      except Exception as e :
           print &gt;&gt; sys.stderr, "Error: " + str(type(e))
           traceback.print_exc()
      finally :
           endTime = time.time()
      print "Total Time: " + str(round((endTime - startTime), 2)) + " Seconds"
      print "Done."
  </code></pre>
  
  <p>The  <strong>"print "{0}".format(path1)"</strong> is printing correct path but I am not able to get that value in perl. 
  How can I store the path value in the variable in perl??</p>