Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
How to make sure that if $mk doesnot match to anyone of @folders,then only push to an array
#!/usr/bin/perl -w use strict; use warnings; my @folders=("inc","Inc","iNc","incr","src","Src"); my $mk = "./media/common/max/tail/common.mk: $(PROJECT_ROOT)/../../ +Utils/inC"; my $folder_match; my @folder_match; foreach $folder_match(@folders) { if($mk !~ /^\/\Q$folder_match\E$/i)# if $mk doesnot match to anyone + of @folders,then only push { push @folder_match ,$mk; } } print "@folder_match\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pushing to an array
by kennethk (Abbot) on Mar 23, 2011 at 20:21 UTC | |
by Anonymous Monk on Mar 23, 2011 at 22:30 UTC | |
by kennethk (Abbot) on Mar 28, 2011 at 15:08 UTC | |
|
Re: Pushing to an array
by wind (Priest) on Mar 23, 2011 at 20:29 UTC | |
|
Re: Pushing to an array
by locked_user sundialsvc4 (Abbot) on Mar 23, 2011 at 20:38 UTC |