in reply to combine arrays, duh!

When you post code here, please show the actual code and the actual output. I had to guess a bit as to what you had...

grep{} is a filtering operation. It doesn't modify anything.
my @E = grep { !/^\n*$/ } @EuserADgrps;
means: transfer each item from @EuserADgrps to @E which satisfies the regex within the grep{}.

/^\n*$/ means: a string that may have zero or more \n characters, but no other characters - a pretty "rare duck"; perhaps a null string, "". When you negate that with the !, it means that for each item in @EuserADgrps, transfer it to @E if it is not one of these "rare ducks". I suspect that this grep{} does nothing to your actual data.

Use @X=map{..blah..;$_}@Y; to transform a Y into an X. But I don't think that you need that here either.

The chomp() function will remove trailing "new lines" from a string, or you can also use chomp() on an array. chomp(@x) will modify @x. So if you don't want that, make a copy:  @y=@x; chomp(@y);#See below:

#!/usr/bin/perl -w use strict; use Data::Dumper; my @EuserADgrps = ("abc\n", "xyz\n"); my @E = grep { !/^\n*$/ } @EuserADgrps; #so weird it's probably wrong print Dumper \@EuserADgrps; print Dumper \@E; chomp(@EuserADgrps); #this modifies the @EuserADgrps array print "now after the chomp of ".'@EuserADgrps'." \n"; print Dumper \@EuserADgrps; __END__ printout: $VAR1 = [ 'abc ', 'xyz ' ]; $VAR1 = [ 'abc ', 'xyz ' ]; now after the chomp of @EuserADgrps $VAR1 = [ 'abc', 'xyz' ];