fork download
  1. #!/usr/bin/perl
  2. use 5.016;
  3. use warnings;
  4.  
  5. sub sign { $_[0] <=> 0 }
  6.  
  7. sub f { (length($_[0]) == length($_[1])) and (sign($_[0]) == sign($_[1])) }
  8.  
  9. foreach(
  10. [110, 119],
  11. [-110, -119],
  12. [-110, 119],
  13. [1234, 214],
  14. [567, 23],
  15. [567, -23]
  16. ){
  17. say join(',', @{$_}), ' -> ', (f(@{$_}) ? 'T' : 'F');
  18. }
  19.  
Success #stdin #stdout 0s 3692KB
stdin
Standard input is empty
stdout
110,119 -> T
-110,-119 -> T
-110,119 -> F
1234,214 -> F
567,23 -> F
567,-23 -> F