Now, in my subroutine I want to run useradd $login and grab the output from the system. If the output is an error (e.g., user already exists), I want to return something like, "ERROR: $login already exists\n", or "ERROR: $login is not a valid UNIX username\n"... If it worked, it should return something like, "SUCCESS: $login added to system" Currently I am croaking if it's not a success, but that destroys my while loop.

Basically, what's the best way to return an error message from a subroutine, and a success message if it succeeds?

Please, be more specific. You want to return an error or success, but still continue the loop. That is not possible - once you return, the loop is done. Probably, you can return two array references: the first array would contain successful users, the second one the failed users.

The loop is in script.pl and calls the subroutine from Script.pm. When I croak in Script.pm it makes script.pl exit, thus breaking the loop in script.pl. I'd rather have the subroutine in Script.pm return the error to a variable in script.pl. Hopefully that clears things up. I'm terrible at explaining things.

When putting a smiley right before a closing parenthesis, do you:

Use two parentheses: (Like this: :) )
Use one parenthesis: (Like this: :)
Reverse direction of the smiley: (Like this: (: )
Use angle/square brackets instead of parentheses
Use C-style commenting to set the smiley off from the closing parenthesis
Make the smiley a dunce: (:>
I disapprove of emoticons
Other