in reply to manipulating arrays

Try grep:
@dirs = grep !/^$/, @testListArray;
gives you an array without empty strings.