in reply to Style & subroutine organization
func3( func2( func1() ) );
use subs qw/foo bar baz/; @_ = ( 1, 2, 3, 4 ); &foo; # sends current contents of @_ print join(' ', @_), "\n"; &bar; # sends current contents of @_ print join(' ', @_), "\n"; &baz; # sends current contents of @_ print join(' ', @_), "\n"; &baz(); # sends an empty list print join(' ', @_), "\n"; sub foo { map { $_++; } @_; # map actually changes the values in @_ } sub bar { map { $_+=2 } @_; # again, map changes @_ } sub baz { map { $_--; } @_; # also chainging @_; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Style & subroutine organization
by demerphq (Chancellor) on Aug 29, 2001 at 21:41 UTC |