use IPC::Run3::Shell { fail_on_stderr=>1 }, qw/convert/; convert $img, '-auto-orient', '-resize', '300x300', $thumb; use IPC::Run3::Shell qw/gs/; gs({fail_on_stderr=>1,show_cmd=>1}, '-o',$OUTPUT, '-sDEVICE=pdfwrite', ..., '-f',$INPUT);