I defined a var like so: $myarray = [ ["a","b"],["c","d"] ] Then in a template I tried something like: <% myarray.each do |element| -%> <%= element[0] %> <% end -%> It does not result in what I expect.... It seems as if myarray was flattened. are multi-dimensional arrays supported? Thanks, Mohamed. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Please ignore... was describing the wrong array... this var works as expected. On Thu, Feb 10, 2011 at 4:44 PM, Mohamed Lrhazi <lrhazi@gmail.com> wrote:> I defined a var like so: > > $myarray = [ ["a","b"],["c","d"] ] > > Then in a template I tried something like: > > <% myarray.each do |element| -%> > <%= element[0] %> > <% end -%> > > It does not result in what I expect.... It seems as if myarray was flattened. > > are multi-dimensional arrays supported? > > Thanks, > Mohamed. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Sorry am confused... it''s end of day.... This does seem to flatten my array: $myarray = [ ["a","b"],["c","d"] ] While this does not: $myarray1=["a","b"] $myarray2=["c","d"] $myarray = [ $myarray1,$myarray2 ] Thanks. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On 02/10/2011 11:00 PM, Mohamed Lrhazi wrote:> Sorry am confused... it''s end of day.... > > This does seem to flatten my array: > > $myarray = [ ["a","b"],["c","d"] ] > > While this does not: > > $myarray1=["a","b"] > $myarray2=["c","d"] > > $myarray = [ $myarray1,$myarray2 ] > > Thanks.Yes. ;-) And while this is potentially bothersome, it''s apparently state of the art. I figured that it''s probably difficult to teach the puppet compiler to be very smart about arrays. See also: http://weblog.etherized.com/posts/175 Regards, Felix -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.