fork download
  1. #!/usr/bin/perl
  2. use feature qw(say);
  3.  
  4. $math = "120%*20%";
  5. $math =~ /(\d+)(\%?)(\*|\+|\/|-)(\d+)(\%?)/g;
  6.  
  7. say eval "$1 $3 $4";
  8.  
Success #stdin #stdout 0s 3740KB
stdin
Standard input is empty
stdout
2400