develooper Front page | perl.perl5.porters | Postings from March 2003

Re: $_ not optional with lexical prints

Thread Previous | Thread Next
From:
Enache Adrian
Date:
March 20, 2003 10:05
Subject:
Re: $_ not optional with lexical prints
Message ID:
20030320173150.GA6188@ratsnest.hole
On Thu, Mar 20, 2003 at 05:47:01PM +0100, H.Merijn Brand wrote:
> > Well, how is Perl supposed to tell the difference between:
> > 
> > my $v;
> > open $v, ">/dev/null" or die $!;
> > $_ = "Test";
> > print $v;
> > 
> > and
> > 
> > my $v = "Test";
> > print $v;
> 
> It does know that $v is bound to an I/O channel.

Hmm, not at compile time ...

The parser generate different things for the first argument in
"print P", "print $p $q"
and
"print $p"

(try with -MO=Terse)

Implementing all that at run time looks rather tricky and tedious.
( IMHO )

Regards
Adi

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About