process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# Execute the perl command
stdout, stderr = process.communicate(input=input_string.encode())

if process.returncode != 0:
    raise ValueError(f"Error {process.returncode}: {stderr.decode()}")

# Return the output as a string and skip the new-line character at the end
return stdout.decode()[:-1]