in reply to Pushing to an array
my $found = 0; foreach $folder_match(@folders) { if($mk =~ /^\/\Q$folder_match\E$/i) {# if $mk doesnot match to any +one of @folders,then only push $found = 1; } } if (not $found) { push @folder_match ,$mk; }
If I were given this task, I would use grep instead, though you could also accomplish this with help from List::MoreUtils.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Pushing to an array
by Anonymous Monk on Mar 23, 2011 at 22:30 UTC | |
by kennethk (Abbot) on Mar 28, 2011 at 15:08 UTC |