The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Read csv into Hash array? kinmak Shell Programming and Scripting 1 05-07-2008 11:35 AM
perl array question from going through hash hankooknara Shell Programming and Scripting 2 07-29-2007 10:53 PM
md5 hash a string or char array in SCO jcarter2333 High Level Programming 5 02-08-2007 04:09 PM
Hash within array, within hash, within array... jsmoriss Shell Programming and Scripting 1 07-10-2006 10:26 PM
getting data list into a hash array topcat8 Shell Programming and Scripting 5 03-09-2004 12:02 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-22-2007
new2ss new2ss is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 133
hash,array and perl

Hi,i have a code fragment below.


Code:
%tag = (); #line 1
  $tag{'info'} = $datastring; #line 2
  $resp = $ua->request(  #$ua is a user agent
       POST 'http://10.2.3.0' ,
       Content_Type  => application/x-www-form-urlencoded
       Content       => [ %tag ] #line 3

I am not sure of what the code does. would appreciate if anyone can correct me.
line 1 is to declare an empty hash
line 2 is to assign the value $datastring to the key 'info'
line 3 is to assign the hash to Content. will this just assign the values or it will also assign the keys and values to Content?
  #2 (permalink)  
Old 05-23-2007
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
Quote:
Originally Posted by new2ss
line 1 is to declare an empty hash
correct
Quote:
Originally Posted by new2ss
line 2 is to assign the value $datastring to the key 'info'
correct
Quote:
Originally Posted by new2ss
line 3 is to assign the hash to Content. will this just assign the values or it will also assign the keys and values to Content?
the hash is being assigned. hash consists of keys and values. both keys and values would be assigned to Content.
  #3 (permalink)  
Old 05-23-2007
Unbeliever Unbeliever is offline
Registered User
  
 

Join Date: Jul 2005
Location: England
Posts: 183
Quote:
Originally Posted by Yogesh Sawant
the hash is being assigned. hash consists of keys and values. both keys and values would be assigned to Content.
Strictly speaking, I think what is being assigned is a reference to an array, the elements of which are the keys and values of the hash %tag (which are the string 'info' and the value of the variable $datastring)
  #4 (permalink)  
Old 05-23-2007
cbkihong cbkihong is offline Forum Advisor  
Advisor
  
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,624
Quote:
Originally Posted by new2ss
I am not sure of what the code does. would appreciate if anyone can correct me.
I will be inclined to say that if you have some basic knowledge Perl, you will understand the syntax used on those 3 lines. But they alone do not make much sense in my opinion. It's actually what the code does that is more important.

So are you working on a program using HTTP::Request? If so, please take a look at the POD for the module. It will tell you what methods are provided, and the arguments you need to use. Then, you simply provide the arguments as needed.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On




All times are GMT -4. The time now is 03:34 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0