develooper Front page | perl.fwp | Postings from February 2005

Re: "Secret" operators

Thread Previous | Thread Next
From:
Andy_Bach
Date:
February 1, 2005 09:18
Subject:
Re: "Secret" operators
Message ID:
OFB4049FEF.EEDF7054-ON86256F9B.005E8C6E-86256F9B.005F0255@uscmail.uscourts.gov
Can I get that just a little slower?

 $b = () = /u/g;

is the same as:

   @a = /u/g;
   $b = @a;

I understand what happens, but it appears to be assigning to an empty list 
- is that filling up the list, so to speak?  Or is it just that it makes 
the 'result' of /u/g assign in array/list context and then that, assigned 
in scalar context to $b gives the list/array count. 

I tried to explain this once and I had to resort to 'and then <mumble 
mumble> and in scalar context, we get the count of the elements in $b!'

a

Andy Bach, Sys. Mangler
Internet: andy_bach@wiwb.uscourts.gov 
VOICE: (608) 261-5738  FAX 264-5932

"Bugs happen. A bug is a test case you haven't written yet."
Mark Pilgrim

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