From: Tels Date: Sat, 1 Dec 2001 10:29:11 +0000 (+0100) Subject: Re: [PATCH] [ID 20011130.166] "in memory" file handles via scalas not documented... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ba964c95d0edb0b5a4c30a52b8a82fe58a4ff0cc;p=p5sagit%2Fp5-mst-13.2.git Re: [PATCH] [ID 20011130.166] "in memory" file handles via scalas not documented in perldoc -f open Message-Id: <200112010931.LAA29309@tiku.hut.fi> p4raw-id: //depot/perl@13402 --- diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 0271862..2b20a4b 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -2666,6 +2666,8 @@ conversion assumes base 10.) =item open FILEHANDLE,MODE,EXPR,LIST +=item open FILEHANDLE,MODE,REFERENCE + =item open FILEHANDLE Opens the file whose filename is given by EXPR, and associates it with @@ -2778,6 +2780,10 @@ argument being C: opens a filehandle to an anonymous temporary file. +File handles can be opened to "in memory" files held in Perl scalars via: + + open($fh,'>', \$variable) || .. + Examples: $ARTICLE = 100; @@ -2802,6 +2808,11 @@ Examples: open(EXTRACT, "|sort >/tmp/Tmp$$") # $$ is our process id or die "Can't start sort: $!"; + # in memory files + open(MEMORY,'>', \$var) + or die "Can't open memory file: $!"; + print MEMORY "foo!\n"; # output will end up in $var + # process argument list of files along with any includes foreach $file (@ARGV) {