Extend foreach to make it similar to awk.