fbicknel has asked for the wisdom of the Perl Monks concerning the following question:
does Perl temporarily grab enough memory to store very_large_file, then slice the first four lines?my @foo = @{[`cat very_large_file`]}[0..3];
The result seems to be that Perl keeps gobbling memory as long as the process generates output, then when the process ends it returns the appropriate slice.#!/bin/bash while :; do rand -N 100 done
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Slicing the output of a command
by hippo (Archbishop) on Jul 09, 2015 at 16:14 UTC | |
|
Re: Slicing the output of a command
by Laurent_R (Canon) on Jul 09, 2015 at 17:57 UTC | |
|
Re: Slicing the output of a command
by marioroy (Prior) on Jul 09, 2015 at 18:48 UTC | |
|
Re: Slicing the output of a command
by KurtSchwind (Chaplain) on Jul 09, 2015 at 19:43 UTC | |
|
Re: Slicing the output of a command
by TomDLux (Vicar) on Jul 10, 2015 at 02:42 UTC | |
by marioroy (Prior) on Jul 10, 2015 at 03:13 UTC | |
by BrowserUk (Patriarch) on Jul 10, 2015 at 03:35 UTC | |
by marioroy (Prior) on Jul 10, 2015 at 04:00 UTC | |
by afoken (Chancellor) on Jul 10, 2015 at 10:21 UTC | |
| |
|
Re: Slicing the output of a command
by wee (Scribe) on Jul 09, 2015 at 22:21 UTC |