Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > variables not being passed into subroutines

Reply
Thread Tools

variables not being passed into subroutines

 
 
echohtp@gmail.com
Guest
Posts: n/a
 
      07-11-2005
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!

 
Reply With Quote
 
 
 
 
xhoster@gmail.com
Guest
Posts: n/a
 
      07-11-2005
"(E-Mail Removed)" <(E-Mail Removed)> wrote:
> 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

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
 
Reply With Quote
 
 
 
 
Tad McClellan
Guest
Posts: n/a
 
      07-11-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) <(E-Mail Removed)> wrote:

> 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.


--
Tad McClellan SGML consulting
(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
A. Sinan Unur
Guest
Posts: n/a
 
      07-11-2005
"(E-Mail Removed)" <(E-Mail Removed)> wrote in
news:(E-Mail Removed) oups.com:

> 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
--
A. Sinan Unur <(E-Mail Removed)>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/cl...uidelines.html
 
Reply With Quote
 
Mark
Guest
Posts: n/a
 
      07-11-2005
(E-Mail Removed) wrote:
> 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
 
Reply With Quote
 
dicktrickle@SoftHome.net
Guest
Posts: n/a
 
      07-12-2005
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) ;

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why hash not being passed into method? Pauli Price Ruby 1 10-27-2008 10:00 PM
Put variables into member variables or function variables? tjumail@gmail.com C++ 9 03-23-2008 04:03 PM
Session variables are not being passed on from page to page Paul fpvt2 ASP General 1 11-02-2004 08:29 PM
Event Arugements not being passed to RaisePostBackEvent Lucas Tam ASP .Net 0 08-19-2003 03:57 PM
Style question regarding subroutines and lexical variables Joseph Ellis Perl Misc 6 07-24-2003 11:37 PM



Advertisments