I would like your help, because I am not able to understand what the following line means:
map {@$_[1 .. 4]} @msft
found in the example code of GD::Graph::ohlc.
Could you please provide me with a hint?
Thank you.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
@msftis an array of arrays where each inner array contains 5 items (date, open/low/high/close prices).The
maptakes each element of@msft, which is an array reference stored in$_and dereferences it via@$_and takes a slice of that array (namely the second through fifth items since the array is 0-based) via the[1..4]. It then returns those four items.mapconcatenates them into a single list.In essence, it is flattening the array of arrays of five elements into a single array made up of the 2nd through 5th items of each subarray.