in reply to querybregarding array utils module in perl

Are you sure your arrays contain what you think they do? See Basic debugging checklist. Since you haven't provided your literal input files wrapped in <code> tags (see How do I post a question effectively?), it's hard to be helpful. Two possibilities I see:
  1. Your second open is failing, and thus you don't know that @array1 is empty. It's probably better if your opens look more like: open(FILE,'<', $file) or die "Open fail on $file: $!"

  2. Your input is literally 1,2,3,4 and so your arrays only have 1 element. In this case, you need to reformat your input files to be newline separated or feed the input through split.

The following code works for me.

#!/usr/bin/perl -w use strict; use Array::Utils qw(:all); my @first = (1,2,3,4); my @second = (1,5,6,7); my @minus = array_minus( @first,@second ); for my $term (@minus) { print "'$term'\n"; }

It outputs

'2' '3' '4'

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.