Thread 2 Arrays vergleichen: und die ergebnisse in arrays speichern (2 answers)
Opened by jane_templar at 2006-12-18 20:18

renee
 2006-12-18 20:35
#72612 #72612
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/perl

use strict;
use warnings;

my @array1 = (1, 2, 3, 4, 5);
my @array2 = (3, 4, 5, 6);

my @nur_array1 = grep{my $i = $_; !grep{$_ eq $i}@array2}@array1;
my @nur_array2 = grep{my $i = $_; !grep{$_ eq $i}@array1}@array2;

print join(",",@nur_array1),"\n",join(",",@nur_array2),"\n";
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread 2 Arrays vergleichen: und die ergebnisse in arrays speichern