variables not being passed into subroutines

E

echohtp

im using several files in this project of mine (a semi intelligent IRC
bot) and i need some of the hashes to be able to be accessed everything
is declared as my, i need them to be passed as hashes for they will be
referenced to for many different users and values. if a code snippet is
needed to be pasted ill do it at another time, thanks i apperciate all
the help! :)
 
X

xhoster

im using several files in this project of mine (a semi intelligent IRC
bot) and i need some of the hashes to be able to be accessed everything
is declared as my, i need them to be passed as hashes for they will be
referenced to for many different users and values. if a code snippet is
needed to be pasted ill do it at another time, thanks i apperciate all
the help! :)

I'll help you another time.

Xho
 
T

Tad McClellan

if a code snippet is
needed to be pasted ill do it at another time,


Then someone will be able to help you at another time.


If you want us to help fix your code, then we would need to
see the code that needs fixing.

Mind-reading is not a time-efficient way of debugging programs.
 
A

A. Sinan Unur

im using several files in this project of mine (a semi intelligent IRC
bot) and i need some of the hashes to be able to be accessed everything
is declared as my, i need them to be passed as hashes for they will be
referenced to for many different users and values. if a code snippet is
needed to be pasted ill do it at another time, thanks i apperciate all
the help! :)

Have you read the posting guidelines for this group? They are posted here
regularly. They are also available on the WWW via the link in my
signature. They contain valuable information on how you can help yourself,
and help others help you, so as to maximize the quantity *and* quality of
responses you receive.

Sinan
 
M

Mark

im using several files in this project of mine (a semi intelligent IRC
bot) and i need some of the hashes to be able to be accessed everything
is declared as my, i need them to be passed as hashes for they will be
referenced to for many different users and values. if a code snippet is
needed to be pasted ill do it at another time, thanks i apperciate all
the help! :)
Guessing wildly (you have given us pretty much zero information with
which to work), you need to pass your hashes as references.

my %hash;

my $result = mySub( \%hash );

sub mySub {
my $hashRef = shift;

# blah blah

}

perldoc perldsc
perldoc perlref
perldoc perlreftut

Of course, I may be a *long* way off track with your requirements.

Mark
 
D

dicktrickle

Best would be passing them as a reference:

sub gimme_hashrefs
{
my $hashref = shift ;

foreach my $key (keys %$hashref)
{
$hashref->{$key} = "value" ;
}
}

my %hash = () ;
gimme_hashrefs(\%hash) ;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top