in reply to (tye)Re: Global, Local, what the..?
in thread Global, Local, what the..?
You are right in your assessment, but the code below should clarify this. Because we're localizing arguments to the sub, you can see how it returns the last evaluated statement. The code below will print "his hat" (without the quotes):
use strict; my @list = qw( this that foo bar ); print join ' ', mungeIt( @list ); sub mungeIt { my @localList = @_; my @stuff = map { s/th/h/ ? $_ : () } @localList; }
Cheers,
Ovid
Update: Oh! I misunderstood tye's question, but clarified the answer. Oh well. All's well that ends well.
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: (Ovid - subroutine return example w/map)
by tye (Sage) on Dec 15, 2000 at 03:34 UTC |