Hash method for ftp


Hi how can I assign the output of the hash method to a variable From the documentation: hash ( [FILEHANDLE_GLOB_REF],[ BYTES_PER_HASH_MARK] ) Called without parameters, or with the first argument false, hash marks are suppressed. If the first argument is ...
Posted On: Thursday 15th of November 2012 09:52:41 PM Total Views:  50
View Complete with Replies

RELATED TOPICS OF Perl PROGRAMMING LANGUAGE




Return number of keys in a hash of hash? Looping through "sub hash"?

I'd like to get the number of keys in hash of hashes. I know that I can do something like $count = keys( %myHash ), but how would I go about finding the number of keys in a sub-hash Alternately, ...
VIEWS ON THIS POST

47

Posted on:

Saturday 10th November 2012
View Replies!

Totally confused over hash behaviour

I have created an array of hashes like so...CODE\t\t# Get user details\t\tmy @user = &getSQL("Users","UserID,Role,FullName","1=1","UserID ASC");\t\t\t\t\tforeach my $user (@user)\t\t{\t\t\t\t$USERS[0]->{$user->{'UserID'}} = $user->{'FullName'};\t\t\t\t$USERS[1]->{$user->{'UserID'}} = $user->{'Role'};\t\t} seem fine so far, however, when i try to access the hashes later on\twith ....CODE\t\tforeach (@USERS) {\t\t\t\tforeach my $key (keys $_){\t\t\t\t\t\tprint "key = $key , value = " . $_->{$key} . "";\t\t\t\t}\t\t}I get....Quote:Type of arg 1 to keys must be hash (not scalar dereference)yet if I do this... CODE\tprint "users[0] = " . $USERS[0];I get ....Quote:users[0] = HASH(0x2c35044) So I don't get it , it is hash isn't so why won't the foreach workcheers,1DMF "In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.""If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"Google Rank Extractor -> Perl beta with FusionCharts , well if I uses data::dumper on @USERS i get..Quote:$VAR1 = { 'Christopher' => 'Christopher Smith', 'Craig' => 'Craig Jones' }; $VAR2 = { 'Christopher' => 'Admin', 'Craig' => 'Admin' }; which is exactly what I expect to see and array of hashes.So what's the problem with my foreach and hash:keys commandI'm lost over all this, if I loop and array of hashes normally I don't need %{} wrapped around $_ ,\t "In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.""If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"Google Rank Extractor -> Perl beta with FusionCharts
VIEWS ON THIS POST

182

Posted on:

Saturday 10th November 2012
View Replies!

lines to a hash: skipping doubles using loop control

No, it is faster than a regexp, but of course this might be of little importance in your situation. Francohttp://www.xcalcs.com : Online engineering calculationshttp://www.megamag.it : Magnetic brakes for fun rideshttp://www.levitans.com : Air bearing pads
VIEWS ON THIS POST

79

Posted on:

Saturday 10th November 2012
View Replies!

A "deep" hash to/from a file?

This seems like something that would be a FAQ, but I couldn't find an answer there. I would like to build a hash from an input text file. The hash can contain other hashes, and so on, to any ...
VIEWS ON THIS POST

44

Posted on:

Sunday 11th November 2012
View Replies!

FAQ 4.61 What's the difference between "delete" and "undef" with hashes?

This is an excerpt from the latest version perlfaq4.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest ...
VIEWS ON THIS POST

36

Posted on:

Sunday 11th November 2012
View Replies!

FAQ 4.60 How can I always keep my hash sorted?

This is an excerpt from the latest version perlfaq4.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest ...
VIEWS ON THIS POST

127

Posted on:

Sunday 11th November 2012
View Replies!

FAQ 4.55 How do I process an entire hash?

This is an excerpt from the latest version perlfaq4.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest ...
VIEWS ON THIS POST

50

Posted on:

Sunday 11th November 2012
View Replies!

untaint a hash eval

all, I was wondering if anyone could give me some pointers as to the best way to untaint the assocative array %config in the following snippet please Do I need to check its content against a suitable regexp somehow ...
VIEWS ON THIS POST

38

Posted on:

Sunday 11th November 2012
View Replies!

How to maintain hash relationship?

I'm not sure if I'm phrasing the question correctly, but here goes -- In the example below, the line: print "CITY = $people{CITY}"; prints this: CITY = Bedrock CITY = Bedrock CITY = Chicago How can I return this hash ...
VIEWS ON THIS POST

41

Posted on:

Thursday 15th November 2012
View Replies!

FAQ 4.56 What happens if I add or remove keys from a hash while iterating over it?

This is an excerpt from the latest version perlfaq4.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest ...
VIEWS ON THIS POST

79

Posted on:

Thursday 15th November 2012
View Replies!

FAQ 4.60 How can I always keep my hash sorted?

This is an excerpt from the latest version perlfaq4.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest ...
VIEWS ON THIS POST

125

Posted on:

Thursday 15th November 2012
View Replies!

Problems with Arithmetic Operators in a Perl hash

Hi , I am trying to go through a file and grab all the arithmetic operators using a perl hash. It is not working for me. What am I doing wrong I think my issue is with the key value ...
VIEWS ON THIS POST

46

Posted on:

Thursday 15th November 2012
View Replies!

Size of a hash

On 10/19/07, Joseph L. Casale wrote: > Is there a way to compute the size of a hash Yes; use the keys() function in a scalar context to get the number of key-value pairs in the hash. my $count ...
VIEWS ON THIS POST

29

Posted on:

Thursday 15th November 2012
View Replies!

FAQ 4.68 How can I make the Perl equivalent of a C structure/C++ class/hash or array of hashes or arrays?

This is an excerpt from the latest version perlfaq4.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest ...
VIEWS ON THIS POST

92

Posted on:

Thursday 15th November 2012
View Replies!

better and great hash

I would wish to store the result of the loop while in a list. I must make how #!/usr/bin/perl -w use strict; use warnings; my %Conf; $Conf{XferMethod} = 'rsync'; $Conf{XferLogLevel} = 1; $Conf{RSyncShareName} = '___1___'; $Conf{ClientNameAlias} = '___2___'; while(my($clef, $valeur) ...
VIEWS ON THIS POST

39

Posted on:

Thursday 15th November 2012
View Replies!

FAQ 4.66 How can I make my hash remember the order I put elements into it?

This is an excerpt from the latest version perlfaq4.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest ...
VIEWS ON THIS POST

205

Posted on:

Thursday 15th November 2012
View Replies!

hash question

Hi I am using object oriented Perl. I have a class static hash variable. sub new { $self->{LINKS} = %allLinks; bless $self, $class; return $self; } sub allLinks { ----- } In procedure, allLinks, how can I refer to the ...
VIEWS ON THIS POST

44

Posted on:

Thursday 15th November 2012
View Replies!

FAQ 4.64 How can I get the unique keys from two hashes?

This is an excerpt from the latest version perlfaq4.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest ...
VIEWS ON THIS POST

182

Posted on:

Thursday 15th November 2012
View Replies!

Re: Deprecated pseudohashes

I was hoping that the fields: hash function could be implemented as a restricted hash in the Perl 5.8+ distributions. That way people could run programs that use fields: hash under Perl 5.6 as easily as under Perl 5.10. The ...
VIEWS ON THIS POST

37

Posted on:

Thursday 15th November 2012
View Replies!

how do i tie a reference to a hash

I'm trying to tie a hash that is returned from a DBI method called fetchrow_hashref. I want to do is override the FETCH method to validate my key names. But fetchrow_hashref returns a reference to a hash, not ...
VIEWS ON THIS POST

133

Posted on:

Thursday 15th November 2012
View Replies!