Nathan Wiger wrote:
> 
> >     >"Print this line.\n"<;
> 
> Some questions:
> 
>    1. How do you specify alternate filehandles to output to?
>       select() doesn't count for the purposes of this question.

It's a shortcut, not a replacement.  Rumors of select's death are
greatly exaggerated.

>    2. How do you support the list form of print, namely:
> 
>          print "Hello there ", $r->fullname, "!\n";

        >"Hello there ", $r->fullname, "!\n"<;

It takes a list, not a string. (See below.)
 
>    3. Can you support here documents with this syntax?

I haven't thought about this yet, but you can always use print.
 
>    4. How does this nest within other perl statements, namely:
> 
>          print "Bob is ", $bob->color if $green;
>          print $r->param($name) . " is on\n" unless $this;

        >"Bob is ", $bob->color< if $green;
        >$r->param($name) . " is on\n"< unless $this;

Unfortunately, the nesting rules get a little complicated.  This is also
going to be an issue with RFC 51 (which is a much bigger win by the
way).  One solution is to allow alternate quotes (p{Bob is ",
$bob->color}).  Another solution is to fiddle with operator precedence.  
 
>    5. How is this syntax a big win over the current print?
>       The only difference I see is it's 3 characters shorter.
>       I realize this is subjective, but a feature request
>       should try to address a problem. What problem is there
>       with the current print operator?

First repeat 10 times - "It's not a replacement, it's a shortcut." 
Sorry, I should have made that more clear in the RFC.  The core of the
suggestion is that it saves a few characters.  Most of my programs have
print statements scattered around and I'd like to have a more compact
syntax.

Here's what I'm working on for v3: >LIST< should return LIST.  In other
words, you can stick print operators just about anywhere:

        my @file = map {s|/home/jericson/||; >$_<} glob '~/*';

or:

        print $fh >"This also goes to stdout.\n"<;

Think tee(1).

Jon
-- 
Knowledge is that which remains when what is
learned is forgotten. - Mr. King

Reply via email to