I have the following piece of code:
my %self;
$self->{txnType} = "foo";
my @orderedRecordTypes = qw(bar baz zed);
my @files = qw(\\should\\not\\pass \\should\\pass\foo_bar
\\should\\pass\\foo_zed \\shouldnt\\pass\\at\\all);
@orderedFiles = map {
my $txnTypeRecType = $self->{txnType} . "_" . $_;
map {
$_ if (split(/\\/))[$#_] =~ /^$txnTypeRecType/io;
} @files;
} @orderedRecordTypes;
print "Passed:\n".join("::", @orderedFiles);
Problem is, @orderedFiles will contain a bunch of undef's inside of it.
How can I prevent it from happening? I can always filter @orderedFiles
after... but I feel that there is some way that I'm missing.
Cheers,
-Andrew
Andrew Stanley
http://www.cs.uml.edu/~astanley/