Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Foreach Loops

by sh1tn (Priest)
on Mar 15, 2005 at 19:26 UTC ( #439727=note: print w/replies, xml ) Need Help??


in reply to Foreach Loops

Not so clean:
for(0..@arr){ $arr[$_] }
Update:
for(1..@arr){ print $arr[--$_], $_, $/ } # diff ?


Replies are listed 'Best First'.
Re^2: Foreach Loops
by samtregar (Abbot) on Mar 15, 2005 at 19:42 UTC
    And not so right. You're off by one!

    $ perl -e '@a = (1, 2, 3); for (0..@a) { print "A$_: $a[$_]\n" }' A0: 1 A1: 2 A2: 3 A3:

    -sam

      That's why I said "Not so clear":
      for(1..@arr){ print $arr[--$_], $_, $/ }


        Actually you said "not so clean" not "not so clear" and your code didn't start from 1.

        -sam

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://439727]
help
Chatterbox?
[stevieb]: ...to cover it all. Awesome thing is that you can dispatch ANY distribution to it (and include all revdeps if desired), and it works all the same as if I'm just testing the RPI code itself
[stevieb]: I'm rather pleased with myself and everything I've leared along this arduous and sometimes frustrating path
[stevieb]: Just need to implement an email plugin or something so I can get alerted remotely if the status of a build has changed from the last run
[stevieb]: Because of the extreme complexity of the testing code itself, I implemented extensive logging so I can troubleshoot much easier by setting a high debug level.
[stevieb]: if you're interested in the test/build backend, have a look at Test::BrewBuild.

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2017-04-28 21:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (529 votes). Check out past polls.