Where is this buffer??
It's part of the system file handle.
Doesnt it count as memory?
It holds data, so it's some form of memory by definition.
But it's a rather small (64k?), fixed-size buffer.
So according to what you said the output is stored in this buffer. Backticks empty them into a scalar all at once.
No. That would require the output of the child to fit in the buffer, but that's impossible since it's a fixed-size buffer. Backticks repeatedly and continually empty the pipe into a scalar. Backticks is more or less equivalent to
my $pid = open(my $fh, '-|', $cmd); my $scalar = ''; 1 while sysread($fh, $scalar, BLK_SIZE, length($scalar)); waitpid($pid, 0); return $scalar;
The scalar keep growing and growing.
Update: Added the first two answers.
In reply to Re^3: Executing Commands with "open"
by ikegami
in thread Executing Commands with "open"
by abhijithtk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |