Your two snippets don't seem to be equivalent. The first (while loop), when run on my dictionary file with the pattern /^zy/, sets $capture to 'zymurgy' (the last match), while the second (grep) sets it to 'zygote' (the first match).
I understand why the while loop works how it does, perhaps someone could explain why grep works differently?
TIA, dave
In reply to Re: Re: Re: What is faster? (grep vs while)
by Not_a_Number
in thread What is faster?
by hotshot
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |