$string is long and I timed it and found that both split and grep in my case take the same time.@arr = split(/\|/, $string); $#arr1 = -1; @arr1 = grep { /reg exp/ } @arr;
In reply to Performance optimization question by vit
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |