Unfortunately, there are several issues with that code. As I documented in the comments, my sub uuencode returns a filename, but you're not using that return value anywhere. Instead, you seem to have just stuck the string "uuencode" into the command right after "mailx" and rearranged the command-line arguments - I'm not sure what you're trying to do there, since I'm pretty sure that doesn't work on the command line either. And Paladin has already identified the issue with your use of system (unfortunately poj's comment was misleading on that issue).
At this point I have to recommend taking a step back. I know that stuff not working can be frustrating. But on the other hand, guessing at syntax doesn't (always) get you further either. I'd have to suggest taking the time to reread perlintro and the documentation on things like system, as well as my node on that topic, as well as Yes, even you can use CPAN and perhaps A Guide to Installing Modules. Invest some time now into understanding those topics to save yourself time afterwards.