CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate: Re: [sdebeaubien] Unix - Thread issue?: Edit Log

Veteran / Moderator

Dec 16, 2009, 4:40 PM

Views: 1371
Re: [sdebeaubien] Unix - Thread issue?

When I made them all into basically just declarations, then set them explicitly elsewhere, that seemed to do the trick.

That's because you ended up declaring them in a parent scope. Vars declared with the my keyword are accessible within their enclosing block, not outside of that block.

It's a very good bet that you're not using the strict pragma, which would have given you a compilation error message.

If you want to show us your before and after code, we can give you a more detailed explanation.

For example:


use strict;
use warnings;

# this var is not accessable outside of this block
my $name = 'FishMonger';

print $name;

That code will generate this compilation error:

Global symbol "$name" requires explicit package name at ...

You probably should read this:

(This post was edited by FishMonger on Dec 16, 2009, 4:44 PM)

Edit Log:
Post edited by FishMonger (Veteran) on Dec 16, 2009, 4:44 PM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives