Open this and then call the block for every line of the resulting file handle, closing the file at the end.
Ok, I see. How about this one?
(=<>)[0..9].print
This seems to work and it is semantically much closer to what you proposed: it opens the file, calls print (which is not a block, but I think, it could be made one for no good) for each requested line.
It is an interesting question, whether we could omit the parentheses around =<>. Although Pugs does not seem to like it, I am not entirely sure that [] should bind so tight.
| [reply] [Watch: Dir/Any] [d/l] [select] |
| [reply] [Watch: Dir/Any] [d/l] |
It might be clearer to write it that way, and it emphasizes that you're printing each element individually, but the other probably works as well, if we assume that most of the builtin types including the aggregate types respond to .print.
| [reply] [Watch: Dir/Any] [d/l] |
@object».meth(@args) # calls one method on each
@object».?meth(@args) # calls method if there is one on each
@object».*meth(@args) # calls all methods (0 or more) on each
@object».+meth(@args) # calls all methods (1 or more) on each
@object».=meth(@args) # calls mutator method on each
@object».:meth(@args) # calls private method on each
Pretty nice, I think. Is there any other programming language that allows anything similar to Perl 6 parallel dispatch?
| [reply] [Watch: Dir/Any] [d/l] |