In addition, two things which will cause you problems later:
- You are defining the function sendm with a prototype that declares no arguments will be passed: the empty parentheses after the function name in
sub sendm() { ... }
Don't use prototypes until you are sure you know what they are for.
- You are calling the function sendm with the & sigil. This disables prototype checking. Don't use this method of subroutine invocation until you are sure you know what it is for. Instead, call the subroutine just as
sendm($var1,$var2);
(but without having used a prototype – and certainly not an empty argument list prototype – in its definition).
Update: Changed wording, layout to improve clarity.