foreach (@versions) { unless($_ eq $version) { runscript(...); } } #### runscript(...) foreach (grep { $_ ne $version } @versions);