in reply to Re: please explain some code
in thread please explain some code

whats the difference between "my $dir = @_" and "my ($dir) = @_" ?
If both mean same thing, then why use () around $dir in first case ?

Replies are listed 'Best First'.
Re^3: please explain some code
by happy.barney (Friar) on Jul 18, 2011 at 11:39 UTC
    "my $dir = @_" is scalar context, so $dir will contain number of elements in @_
    "my ($dir) = @_" is list context, so $dir will contain first value of @_ (if exists)