#!/usr/bin/perl
use strict;
use warnings;

my @a = ( 'b', 'c', 'f' );
my @b = ( 'a', 'd' );
my @c = ( 'c', 'd', 'e' );

my %seen;
my @suniq = sort grep {!$seen{$_}++} @a, @b, @c;
foreach my $arr (\@a, \@b, \@c) {
    my %th = map { ( $_ => 1 ) } @$arr;
    @$arr = map { $th{$_} ? $_ : undef } @suniq;
}

use Data::Dumper;
print Dumper(\@a,\@b,\@c);
