Process substitution feeds the output of a process (or processes)
into the stdin of another process
Because pipes create a new shell, $count wont be assigned
$ cat file | while read line; do ((count++)); done
$ echo $count
We can however use process subsititution to work around this:
$ while read line; do ((count++)); done < <(cat file)
$ echo $count # the variable *does* exist in the current shell