BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:
Open a ram file for output, seek into it and print something and the length of the scalar changes to reflect the 'content':
open RAM, '>', \$ram; seek RAM, 10, 0; print RAM ' '; print length $ram;; 12
It also works as expected if I use binmode ':raw' on the filehandle:
open RAM, '>', \$ram; binmode RAM, ':raw' or warn $!; seek RAM, 10, 0; print RAM ' '; print length $ram;; 12
But apply ':raw' on the open, then nothing gets printed to the scalar.
open RAM, '>:raw', \$ram; seek RAM, 10, 0; print RAM ' '; print length $ram;; Use of uninitialized value in length at (eval 3) line 1. 0
Is this a restriction I've missed or a bug?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Ram file bug?
by PodMaster (Abbot) on Feb 16, 2006 at 09:43 UTC | |
by BrowserUk (Patriarch) on Feb 16, 2006 at 10:04 UTC | |
by PodMaster (Abbot) on Feb 16, 2006 at 10:09 UTC | |
|
Re: Ram file bug?
by jmcnamara (Monsignor) on Feb 16, 2006 at 10:27 UTC | |
by BrowserUk (Patriarch) on Feb 16, 2006 at 10:37 UTC | |
by Anonymous Monk on Feb 16, 2006 at 11:25 UTC | |
by BrowserUk (Patriarch) on Feb 16, 2006 at 18:35 UTC | |
by martin (Friar) on Feb 17, 2006 at 01:26 UTC |