develooper Front page | perl.perl6.language | Postings from May 2004

Re: C style conditional statements

Thread Previous | Thread Next
May 12, 2004 11:48
Re: C style conditional statements
Message ID:
Larry Wall skribis 2004-05-12 11:39 (-0700):
> On Wed, May 12, 2004 at 08:15:36PM +0200, Juerd wrote:
> : A2 says $*STDIN and $*STDOUT. Has this been changed?
> It's $*IN and $*OUT.

I like this change!

> : I'd hate to have to specify stdin and stdout in throw away scripts.
> Just because there's no longer a selected filehandle doesn't mean
> you have to specify stdout.  It's still the default.  It's just no
> longer the default default.  Translated Perl 5 scripts that select
> the current output filehandle will need to use an explicit variable
> to hold the "default".

Some tools like Irssi and my own PLP tie a handle and then select it, to
intercept the output of normal print statements. But STDOUT can still be
specified explicitly if that's where you want things to go. 

This makes the tools compatible with most code out there, for easy
copying and pasting. (Think of it what you want, but this is and will
stay the way beginners create their programs.)

If there is just a default, but no way of changing it, you'd have to tie
$*OUT itself. But how would one then reach the real stdout, in case it's

I hope I'm missing something :)

> :     for <> {
> :         s:g/\w+/WORD/;
> :         print;
> :     }
> That will work fine in Perl 6.  It won't even chew up all your memory
> as it would in Perl 5.

The lazy readline list is one of the things that make me love Perl 6. I
didn't even think about this snippet in Perl 5 context.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About