BooK wrote:
> 
> En r�ponse � Piers Cawley <[EMAIL PROTECTED]>:
> 
> > Ian Phillipps <[EMAIL PROTECTED]> writes:
> > >> --- Tim Ayers ------------------------ 21
> > >> #!/usr/bin/perl
> > >> printf"%010d\n",$.,<>
> > >
> > > Harumph. I remember something like this approach flitting through my
> > > mind, but, I thought, the $. would be evaluated before the <>, so it
> > > would be zero.
> > >
> > > Moral: try it!

first I thought `but of cource', a bit later I was a bit confused... :)

more clear would be something like:

<>;printf"%010d\n",$.

which does not work?! as I see it this is void context, but seems like I'm wrong
'cos it takes away one line... well list context can be forced:

@_=<>;printf"%010d\n",$.

I don't know why I did something like

printf"%010d\n",$_=@_=<>

which is the same :)

> > >
> > > Hmm... why isn't it zero?
> >
> > Because perl passes arguments by reference. So $. gets shoved on the
> > stack (as $.) and <> gets evaluated in an array context so that the
> > results can be shoved on the stack. So, when printf comes to read the
> > value of $. '<>' has already been evaluated.
> 
> So I guess
> 
> #!/usr/bin/perl
> printf"%010d\n","$.",<>

P! Vladi.
-- 
Vladi Belperchinov-Shabanski <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Personal home page at http://www.biscom.net/~cade
DataMax Ltd. http://www.datamax.bg
Too many hopes and dreams won't see the light...

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to