[Pdx-pm] New DA question - sub return'd values

Roderick A. Anderson raanders at acm.org
Thu Jan 8 13:09:46 CST 2004


On Thu, 8 Jan 2004, Ovid wrote:

> --- "Roderick A. Anderson" <raanders at acm.org> wrote:
> > On Thu, 8 Jan 2004, Ovid wrote:
> > 
> > Got all the above.  And basically understood it already.
> 
> I hope I didn't sound too pedantic.  I often don't know the skill level
> of the person I am responding to and I try to be cognizant of the fact
> that others might be reading.

No problem here.  I try to ask my questions so it sounds like I know less 
than I do (or think I do :-).  I really like your replies.  In fact I'm 
saving them in case I have to explain to someone else.  I'm the CPF 
(Certified Perl Fanatic) here and about so get questions sometimes.

> I assume you're asking if this is OK inside of the main namespace? 

Yes.  Namespace.  I've been doing a little too much work on Linux 
Vservers, PostgreSQL, and XML.  They all get mixed together, even this 
early in the morning.

> In that example, we're still in the main namespace (which I think was
> your question), but we've stomped on $_ in &main::zero and the regex
> match in the while loop will never succeed.  From your email, it looks
> like you understand this issue, but just in case, I thought I would
> clarify that.

Thanks.  Since before my current job and these recent projects I only
programmed sporadicly and mostly little, simple, scripts reenforcement is
GOOD.

> The reason why that simplistic example is important to me is because I
> often build small utility scripts and as they grow, I pull out large
> chunks into subroutines.

I'm getting there quickly.  I'm copy and pasting the same code in many  
scripts (CGI and utility).  Once it get it stabilized I'm going to do the 
same.

> If I've already predeclared any use of $_ as local, I don't have to
> worry about going back and fixing it when the code gets moved.

A very good idea.  I think I got bit by this a couple of times and played 
hell sorting it out.  Part of the reason I'm using a hash to hold global 
variables is if I step on them it truly is my fault.


Best,
Rod
-- 
    "Open Source Software - You usually get more than you pay for..."
     "Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL"





More information about the Pdx-pm-list mailing list