in reply to execute a file

It's quite possible that 'cjpeg.exe' isn't in your Path. To avoid problems like this, specify the full path to cjpeg.exe, like so:
system("C:\\WINNT\\System32\\freecell.exe") == 0 or die "Returned $?";
(Example with freecell because I don't know where cjpeg is and don't want to give misinformation)

stephen