CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Can't assign string in array -- HELP

 



tgraupmann
New User

Aug 25, 2005, 11:04 AM

Post #1 of 4 (512 views)
Can't assign string in array -- HELP Can't Post

Why won't it assign $viewstate correctly?


Code
my $viewstate = "blahdjfhdsjhsfd"; 
my $postbody = [
'__VIEWSTATE' => $viewstate,
'TxtAccountName%3ATxtTextBox' => 'sfdsdf',
'TxtUserName%3ATxtTextBox' => 'dsfsfsdf',
'TxtPassword%3ATxtTextBox' => 'dsfdsfsd',
'BtnSignIn' => 'Sign-In'
];



tgraupmann
New User

Aug 25, 2005, 11:35 AM

Post #2 of 4 (507 views)
Re: [tgraupmann] Can't assign string in array -- HELP [In reply to] Can't Post

Nevermind this works just fine!


KevinR
Veteran


Aug 25, 2005, 12:35 PM

Post #3 of 4 (505 views)
Re: [tgraupmann] Can't assign string in array -- HELP [In reply to] Can't Post

I think you should be using the annonymous hash brackets ({}) though since it looks like you are creating a reference to a hash.


Code
my $postbody = { 
'__VIEWSTATE' => $viewstate,
'TxtAccountName%3ATxtTextBox' => 'sfdsdf',
'TxtUserName%3ATxtTextBox' => 'dsfsfsdf',
'TxtPassword%3ATxtTextBox' => 'dsfdsfsd',
'BtnSignIn' => 'Sign-In'
};


but maybe that will still work with square brackets: []
-------------------------------------------------


davorg
Thaumaturge / Moderator

Aug 30, 2005, 4:51 AM

Post #4 of 4 (500 views)
Re: [KevinR] Can't assign string in array -- HELP [In reply to] Can't Post


In Reply To
I think you should be using the annonymous hash brackets ({}) though since it looks like you are creating a reference to a hash.


I'm guessing that this is to be used with the POST method from HTTP::Request::Common - which (for some reason) uses an array where you'd expect a hash.

See the docs.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives