punter

like === of JS

Oct 30th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.24 KB | None | 0 0
  1. sub eqq {
  2.     my ($s1, $s2) = @_;
  3.  
  4.     if (! defined $s1) {
  5.         return ! defined $s2;
  6.     }
  7.     elsif (! defined $s2) {
  8.         return '';
  9.     }
  10.    
  11.     if (ref $s1 ne ref $s2) { return ''; }
  12.    
  13.     return $s1 eq $s2;
  14. }
Add Comment
Please, Sign In to add comment