I have a function to which I pass variables from textboxes (created using the TK Modules) to a subroutine (so I have textboxes name $one $two $three, sub Pie) then what i want is for the new subroutine to read the values from these text boxes, so i call sub{Pie($one,$two,$three)}. However, when i try to get the data back, im having problems. I say "my ( $one_array, $two_array, $three_array ) = @_;" Just as i have learned from tutorials! However, when i try to get the data back out, by writing (example, for the variable $one) my $one_val = $one_array->get(); - However, perl is having trouble with this, it gives me an error Tk::Error: wrong # args: should be ".text get index1 ?index2?" - and i dont udnerstand what this means, can anybody help atall ?
the exact code goes...

the function which takes the variables first...


Perl:
--------------------------------------------------------------------------------
sub createAccount { my( $Username_arr, $Name_arr, $Password_arr, $PassCheck_arr, $Email_arr, $Sylabus_arr, $Instrument_arr, $Theory_arr, $Practical_arr ) = @_; my $username = $Username_arr->get; my $name = $Name_arr->get(); my $password = $Password_arr->get(); my $passconfirm = $PassCheck_arr->get(); my $email = $Email_arr->get(); my $syll = $Sylabus_arr->get(); my $inst = $Instrument_arr->get(); my $theory_g = $Theory_arr->get(); my $practical_g = $Practical_arr->get(); my $test = new MainWindow; $test->title( $Username_arr ); $test->geometry("335x160"); } return true;
--------------------------------------------------------------------------------


and the code for the command button...

Perl:
--------------------------------------------------------------------------------

my $CreateUser = $CreateAcct->Button( -text => "Create Account", -command => sub{createAccount($txtNewUName,$txtNewName,$txtNe +wPassword,$txtNewCPassword,$txtNewEmail,$ListNewSyl l,$ListNewInst,$txtNewTheory,$txtNewPractical)} )->pack;
--------------------------------------------------------------------------------

sorry for any formatting problems :P

thanks!

Edited 2004-02-23 by Ovid -- Added code tags. Did not change other formatting other than to remove an errant left square bracket.


In reply to Perl TK Problem! by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.