Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Trouble Chaining map function

by flowdy (Scribe)
on Jun 14, 2014 at 20:25 UTC ( [id://1089908]=note: print w/replies, xml ) Need Help??


in reply to Trouble Chaining map function

print join "\n", map { $t = $_ ; join("\t", $_."\t", map { $data{$_,$t} ? "X" : " " } @days ) } @time;
This code differs from yours in several regards:
  • no redundant use of topicalizing single-scalar for to print
  • the time as first tab-separated item of the inner join
  • for each time an own line

To me this looks like misusing map. Better use it solely to calculate results of values from a list by one or very few statements and no nested map, and putting the results into a new list or array at the same time.

Replies are listed 'Best First'.
Re^2: Trouble Chaining map function
by jaypal (Beadle) on Jun 15, 2014 at 00:45 UTC

    Thanks flowdy was the explanation. I agree with you, I wouldn't use this in a production code. I was just trying to understand how nesting can be done. I am of the type who would learn more by looking at a solution then reading through the doc. Your solution has shown me a clear way of nesting maps and I appreciate your help for that. :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (7)
As of 2024-04-23 13:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found