fork download
  1. sub check {
  2. my ($p1, $p2) = @_;
  3. if (($p1 =~ /\d+/) && ($p2 =~ /\d+/)) {
  4. if ($p1 == $p2) {
  5. print "\nSAME\n";
  6. }
  7. $sum = $p1 + $p2;
  8. print "Total = $sum\n";
  9. $mul = $p1 * $p2;
  10. print "Product = $mul\n";
  11. }
  12. elsif (($p1 =~ /\w+/) && ($p2 =~ /\w+/)) {
  13. if ($p1 eq $p2) {
  14. print "\nSAME\n";
  15. }
  16. }
  17. }
  18.  
  19. print "Enter two numbers :- ";
  20. chomp (@line = <stdin>);
  21. &check (@line);
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
===SORRY!===
Unsupported use of =~ to do pattern matching; in Perl 6 please use ~~ at line 3, near " /\\d+/) &&"
stdout
Standard output is empty