Just to confirm, this script has not been completed (I still need to add the ADD and SUBTRACT functions). Although, i have tested what i have so far and the script has compiled an run correctly however, if a user enters the divide function, it will compute both the numbers but use the multiplication function rather than divide even though the divide function has been stated.

Your if statements do not mean what you think. You must check $function against each of the options. Also, you should use 'or' rather than '||' because it has lower presidence than the comparison operators.

Another nice way to perform a calculation is using Perl's eval, although risky if the calculation comes from an untrusted source (could be protected by using the safe module). We can enter long complex calculations which fulfill the regexp, without having to provide specific properties for each operation: