On Thursday, August 2, 2012 9:30:48 AM UTC-5, Despite wrote: > > Is there a clean way to index into an array returned by a function? When > I try to do it directly, I get a parser error. I have to assign the array > to a new variable and index that. > > # This fails > $dc = split($domain,'[.]')[0] > > # This works > $split_domain = split($domain,'[.]') > $dc = $split_domain[0] > > I guess it really doesn't matter, it's just annoying and breaks my > expectations. >
I've seen another area recently where the return values of functions cannot be used directly as an ordinary value (they cannot be used as resource titles). I suspect that the parser just doesn't anticipate those cases, but perhaps there's something about the grammar or implementation that makes such cases hard. I encourage you to file a feature request. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/2AWbfIYcLMIJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
