in reply to Re: Replicate open() and close()
in thread Replicate open() and close()

Thanks Fletch, I should have looked more in the docs .. they even call their example sub 'myopen'!:

Declared as: sub myopen (*;$)
Called as: myopen HANDLE, $name

Replies are listed 'Best First'.
Re: Re: Re: Replicate open() and close()
by sauoq (Abbot) on Jan 30, 2003 at 00:05 UTC
    Declared as: sub myopen (*;$)

    Careful... The example in the docs won't do what you are asking for. It will complain about calling myopen() with 3 arguments. If you want it to act like perl's open(), use the same prototype that perl does. That's *;$@ as I pointed out in my reply to Fletch.

    perl -le 'sub myopen(*;$){print@_}myopen(FOO,"<","bar")' Too many arguments for main::myopen at -e line 1, at end of line Execution of -e aborted due to compilation errors.
    -sauoq
    "My two cents aren't worth a dime.";