in reply to Re: flock with anonymous filehandle
in thread flock with anonymous filehandle

Also, try using the var = shift syntax for getting arguments in a subroutine. I've run into too many problems trying to use the @_.

The syntax used is perfectly fine. The thing that one must remember when using @_ is that:

my $arg = @_;

will assign the number of arguments to $arg, but:

my($arg) = @_;

will assign the first argument to $arg. (The ()s give list context to the right-hand side of the my assignment.)

update: Of course, one must also remember to assign all the arguments at once when using @_.

Replies are listed 'Best First'.
Re: Re: Re: flock with anonymous filehandle
by Xxaxx (Monk) on Jun 10, 2001 at 06:32 UTC
    Thanks for the comments.
    I was wondering though, if the admonition against using
    my($arg) = @_;
    is because some folks forget and leave out the all importand ()?

    Or is there some other reason that the shift is seemingly preferred?

    Thanks
    Claude

      my$arg=shift; gives you the next Argument whether in main or in sub thanks to the magic shift!