in reply to Hash Question

Also, how can I make this hash accessible outside of the while loop I had it created in? Is there a way to create global variables from local ones?

At a guess, you're looking for something like this: declare the hash variable outside your loop.

my %hash; while (<>) { $hash{$_}++; } # %hash is accessible outside the while() loop print join ', ' keys %hash;

If that's not what you're looking for, post a short excerpt of your code so we can see what you mean.

--
Any sufficiently interesting Perl project will depend upon at least one module that doesn't run on Windows.

Replies are listed 'Best First'.
Re^2: Hash Question
by perl_n00b (Acolyte) on Nov 23, 2009 at 02:07 UTC
    I posted my code above but I didn't include that I did declare the hash before the while loop yet I can't see it after the while loop