Hello Dean,
Thanks for this explanation! I apologise for not replying sooner, but I wanted to look at the whole question with a fresh pair of eyes first. You are absolutely right:
my @dirs.push: $_.split('/') for @paths;
say @dirs.perl;
shows:
[("", "aardvark", "bison", "camel", "dromedary").Seq, ("", "aardvark",
+ "bison", "camel", "dromedary", "elephant").Seq]
(i.e., 2 unconsumed Seq objects), but with .cache added to the split they are Lists:
[("", "aardvark", "bison", "camel", "dromedary"), ("", "aardvark", "bi
+son", "camel", "dromedary", "elephant")]
— and therefore can be iterated as often as needed.
Update:
upon consideration, using .cache may be more efficient since it is lazy
Where is this documented?
Thanks again,
|