use Inline Python; ... __END__ __Python__ Python source code goes here.