Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^4: How to print an array of multidimensional arrays with a for or foreach loop

by tobyink (Abbot)
on Aug 11, 2014 at 08:02 UTC ( #1096970=note: print w/replies, xml ) Need Help??


in reply to Re^3: How to print an array of multidimensional arrays with a for or foreach loop
in thread How to print an array of multidimensional arrays with a for or foreach loop

Why the "but"? If-then-else also returns the value of "then" or "else". But if-then-else is parsed as a whole statement making it hard to use in an expression.

use v5.14; # Ternary is convenient to use in an expression... my $value1 = int(rand 2) ? 666 : 999; # If-then-else is less convenient... my $value2 = do { if (int rand 2) { 666 } else { 999 } }; say for $value1, $value2;
  • Comment on Re^4: How to print an array of multidimensional arrays with a for or foreach loop
  • Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2016-10-01 01:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (574 votes). Check out past polls.