ybnormal has asked for the wisdom of the Perl Monks concerning the following question:
Below is the sample oode that I have a problem with. It is aimed to do the same as above program except doing it on STDOUT, but seek() doesn't seem to move the file pointer and it starts printing '0' from where the current pointer is, instead of overriding existing strings.use strict; use warnings; $|=1; open(F, '+< temp'); print F "11111111111111111111111111111111\n"; for (0..31){ seek(F, $_, 0); print F '0'; sleep(1); } close(F);
Does seek() not work on STDOUT in the same way as it does on the files, or am I doing something wrong ? Appreciate your help.use strict; use warnings; $|=1; open(STDOUT, '+<'); print STDOUT "11111111111111111111111111111111\n"; for (0..31){ seek(STDOUT, $_, 0); print STDOUT '0'; sleep(1); } close(STDOUT);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: seek() command on STDOUT
by BrowserUk (Patriarch) on Apr 30, 2010 at 05:11 UTC | |
by afoken (Chancellor) on Apr 30, 2010 at 05:47 UTC | |
by BrowserUk (Patriarch) on Apr 30, 2010 at 06:28 UTC | |
|
Re: seek() command on STDOUT
by cdarke (Prior) on Apr 30, 2010 at 08:52 UTC | |
|
Re: seek() command on STDOUT
by afoken (Chancellor) on Apr 30, 2010 at 15:13 UTC | |
by ybnormal (Novice) on Apr 30, 2010 at 21:21 UTC | |
by BrowserUk (Patriarch) on Apr 30, 2010 at 21:46 UTC | |
by ybnormal (Novice) on May 01, 2010 at 04:02 UTC |