Re: subroutines, my and parentheses

2011-11-01 Thread Jim Gibson
On 11/1/11 Tue Nov 1, 2011 12:02 PM, "rent0n" scribbled: > Hi all, > > Can somebody please explain what is the difference between: > > sub subroutine { > my $var = @_; > ... > return 1; > } > > and: > > sub subroutine { > my ($var) = @_; > ... > return 1; > } > > I think it's something rel

Re: subroutines, my and parentheses

2011-11-01 Thread Uri Guttman
On 11/01/2011 03:02 PM, rent0n wrote: Hi all, Can somebody please explain what is the difference between: sub subroutine { my $var = @_; that puts @_ in a scalar context which returns the number of elements in an array. ... return 1; } and: sub subroutine { my ($var) = @_; ... that puts

subroutines, my and parentheses

2011-11-01 Thread rent0n
Hi all, Can somebody please explain what is the difference between: sub subroutine { my $var = @_; ... return 1; } and: sub subroutine { my ($var) = @_; ... return 1; } I think it's something related to the context but I'm not completely sure.