variables not being passed into subroutines

Discussion in 'Perl Misc' started by echohtp@gmail.com, Jul 11, 2005.

  1. Guest

    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! :)
     
    , Jul 11, 2005
    #1
    1. Advertising

  2. Guest

    "" <> 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
     
    , Jul 11, 2005
    #2
    1. Advertising

  3. <> 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
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Jul 11, 2005
    #3
  4. "" <> wrote in
    news::

    > 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 <>
    (reverse each component and remove .invalid for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
     
    A. Sinan Unur, Jul 11, 2005
    #4
  5. Mark Guest

    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
     
    Mark, Jul 11, 2005
    #5
  6. Guest

    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) ;
     
    , Jul 12, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lucas Tam
    Replies:
    0
    Views:
    421
    Lucas Tam
    Aug 19, 2003
  2. dee
    Replies:
    9
    Views:
    515
    Joseph Byrns
    Apr 15, 2005
  3. Anand
    Replies:
    2
    Views:
    906
    Anand
    Sep 11, 2003
  4. Paul fpvt2
    Replies:
    1
    Views:
    195
    Aaron [SQL Server MVP]
    Nov 2, 2004
  5. Pauli Price
    Replies:
    1
    Views:
    84
    Xavier Shay
    Oct 27, 2008
Loading...

Share This Page