Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Why does each() always re-evaluate its argument?

by ikegami (Patriarch)
on Dec 06, 2023 at 21:27 UTC ( [id://11156145]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    while ( my ( $k, $v ) = each( %h ) ) {
      ...
    }
    
  2. or download this
    while ( my ( $k, $v ) = each( %{ create_new_hash() } ) ) {
      ...
    }
    
  3. or download this
    while ( my ( $k, $v ) = each( %h ) ) {
      ...
    }
    
  4. or download this
    my $iter = get_iter( \%hash );
    while ( my ( $k, $v ) = $iter->() ) {
       ...
    }
    
  5. or download this
    using ( var iter = dict.GetEnumerator() ) {
       while ( iter.MoveNext() ) {
    ...
          ...
       }
    }
    
  6. or download this
    foreach ( var entry in dict ) {
       ...
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11156145]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (7)
As of 2024-04-18 17:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found