while(<@INC>) #### my @copy = @INC; while(defined($_ = shift(@copy))) { # push to @copy as necessary }