Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: A better (ie.more concise) way to write this?

by LanX (Chancellor)
on Dec 13, 2013 at 16:53 UTC ( #1067044=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      DB<132> sub cycle { $_[1]++; $_[1] %= $_[0] }
    
    ...
    
      DB<135> cycle 3 => $h{a}{b}[2]{c};   \%h
     => { a => { b => [undef, undef, { c => 0 }] } }
    
  2. or download this
    $h{a}{b}[2]{c}->cycle(3)
    
  3. or download this
      DB<160> $cycle = sub { $_[0]++; $_[0] %= $_[1] }
     => sub { "???" }
    ...
    
      DB<163> $h{a}{b}[2]{c}->$cycle(3);   \%h
     => { a => { b => [undef, undef, { c => 0 }] } }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1067044]
help
Chatterbox?
[marto]: good morning all, TCIF
[Corion]: Hi marto! Indeed, Crunchy be thanked!
choroba had a Christams party at work yesterday. Slow morning today...
[Corion]: I guess I should not read some discussions on HackerNews - the crowd there is weirdly different - "you have to stay current in tech" (by following all the latest JS trends) is a meme there, but it doesn't really match my experience
[Corion]: At least in my area, experience can beat most new tech anyway because most new tech is just a rehash of things abandoned in the 70s and we still have a lot of that ;)
[Corion]: choroba: Ah, that will be next Friday for $work ;) Drinking enough water is key ;))

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2016-12-09 10:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (150 votes). Check out past polls.