Perl Weekly Challenge 143: Calculator and Stealthy Numbers
These are some answers to the Week 143 of the Perl Weekly Challenge organized by Mohammad S. Anwar.
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on December 19, 2021 at 24:00). This blog post offers some solutions to this challenge, please don’t read on if you intend to complete the challenge on your own.
Task 1: Calculator
You are given a string, $s, containing mathematical expression.
Write a script to print the result of the mathematical expression. To keep it simple, please only accept + - * ().
Example 1:
Input: $s = "10 + 20 - 5"
Output: 25
Example 2:
Input: $s = "(10 + 20 - 5) * 2"
Output: 50



