fork download
  1. #!/usr/bin/perl
  2. # your code goes here
  3.  
  4. use strict;
  5. use warnings;
  6. use v5.10.1;
  7.  
  8. my @array1 = split(/\s+/, "20.08.2018 21.08.2018 22.08.2018");
  9. my @array2 = split(/\s+/, "18.08.2018 19.08.2018 20.08.2018");
  10.  
  11. my @arrayExists = grep {$_ ~~ @array1} @array2;
  12. my @arrayNotExists = grep {!($_ ~~ @array1)} @array2;
  13.  
  14. print 'EXISTS: '.join(', ', @arrayExists)."\n";
  15. print 'NOT EXISTS: '.join(', ', @arrayNotExists)."\n";
Success #stdin #stdout #stderr 0s 17752KB
stdin
Standard input is empty
stdout
EXISTS: 20.08.2018
NOT EXISTS: 18.08.2018, 19.08.2018
stderr
Smartmatch is experimental at prog.pl line 11.
Smartmatch is experimental at prog.pl line 12.