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.
In reply to Re: Pushing to an array
by kennethk
in thread Pushing to an array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |