On Tuesday, March 25, 2003, at 03:35 PM, Mark Biggar wrote:
sub myprint(+$file is IO:File is rw ::= IO:STDOUT, [EMAIL PROTECTED]) {...}
open f ">/a/d/v/f/r"; myprint file => f, "Hello World!\n"; # goes to f myprint "Differnet World!\n"; # goes to IO:STDOUT
As a side note... that sig will not do the behavior you've described. You instead want this:
sub myprint([EMAIL PROTECTED], +$file is IO:File is rw ::= IO:STDOUT) {...}
The named parameter +$file has to go behind the positional [EMAIL PROTECTED] in the signature, but still goes _before_ [EMAIL PROTECTED] in the actual call.
(Insert image of a five-year-old me jumping up and down on a chair, pointing my finger, saying "see! see! I told you people would do that!")
MikeL