Remove default data hash sorting in perl script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Remove default data hash sorting in perl script?
# 1  
Old 10-06-2010
Remove default data hash sorting in perl script?

Hi,

I have a datahash with 'n' number of values in perl script. I am writing a xml file from the datahash. I am getting output with sorting(Field sorting). My question is that i don't want any default sorting.whatever i am inserting into datahash it should give same xml file.

Any help?

this is bleow code
Code:
my %dataHash;
%dataHash = ();
#$loginCnt is key
# $usrLoginID and $usrPriv retrieved value
$dataHash{Server}{Login}{$loginCnt}{DBLogin} = $usrLoginID;  
$dataHash{Server}{Login}{$loginCnt}{Access} = $usrPriv;


Last edited by Franklin52; 10-06-2010 at 03:23 AM.. Reason: Please use code tags!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compare values of hashes of hash for n number of hash in perl without sorting.

Hi, I have an hashes of hash, where hash is dynamic, it can be n number of hash. i need to compare data_count values of all . my %result ( $abc => { 'data_count' => '10', 'ID' => 'ABC122', } $def => { 'data_count' => '20', 'ID' => 'defASe', ... (1 Reply)
Discussion started by: asak
1 Replies

2. Shell Programming and Scripting

Sorting values of hash in ascending order using Perl

I want to sort values of a hash in ascending order. my %records; for my $value (sort values %records){print $value,"\n";} When I use the above code I get values in this order: 1,10,11,2,3,4,5,6,7,8,9. But, I need values in my output in this order: 1,2,3,4,5,6,7,8,9,10,11. Can Someone... (1 Reply)
Discussion started by: koneru_18
1 Replies

3. Shell Programming and Scripting

Perl: Sorting a hash value that is a list.

Hi Folks I am very much a newbie at perl but picking it up and I'm hoping you can help. I have a file input that details all the /etc/group files in our enterprise in the following format: "<host>:<group>:<gid>:<users>" I want to parse this data display it as the following:... (9 Replies)
Discussion started by: g_string
9 Replies

4. Programming

perl script to create hash.

Hi, I have the xml file file this, perl script to create hash<p> <university> <name>svu</name> <location>ravru</location> <branch> <electronics> <student name="xxx" number="12"> <semester number="1"subjects="7" rank="2"/> </student> <student name="xxx"... (1 Reply)
Discussion started by: veerubiji
1 Replies

5. Shell Programming and Scripting

Sorting keys of a hash in perl

hi all, i have a small problem regarding sorting the keys in a hash. my %hash; for($i=0;$i<19;$i++) { $hash{$i}=$i; } foreach $c (sort keys %hash) { print "\n $hash{$c}"; } (1 Reply)
Discussion started by: niteesh_!7
1 Replies

6. Shell Programming and Scripting

Perl Hash:Can not keep hash data in the same order that it was inserted

Can Someone explain me why even using Tie::IxHash I can not get the output data in the same order that it was inserted? See code below. #!/usr/bin/perl use warnings; use Tie::IxHash; use strict; tie (my %programs, "Tie::IxHash"); while (my $line = <DATA>) { chomp $line; my(... (1 Reply)
Discussion started by: jgfcoimbra
1 Replies

7. Shell Programming and Scripting

perl-extract data from hash values

Hello, I have parsed an xml file using perl to get the hash values and the output looks like this $VAR1 = { 'RT' => { 'List' => { 'String' => ... (1 Reply)
Discussion started by: userscript
1 Replies

8. Shell Programming and Scripting

PERL: reading 2 column data into Hash file

I am trying to read in a 2 column data file into Perl Hash array index. Here is my code. #!/usr/bin/perl -w use strict; use warnings; my $file = "file_a"; my @line = (); my $index = 0; my %ind_file = (); open(FILE, $file) or die($!); while(<FILE>) { chomp($_); if ($_ eq '') { ... (1 Reply)
Discussion started by: subhap
1 Replies

9. Shell Programming and Scripting

passing a hash to another script in perl

I have a script (say script1.sh ) and I am calling a script (say script2.sh) within the script1.sh. Here in script1.sh I have a hash ( say %hash1) and i have to pass this hash to script2.sh. Basically i have to do some processing in Scirpt2.sh based on the hash(key,values). I wanted to know how can... (2 Replies)
Discussion started by: ammu
2 Replies

10. Shell Programming and Scripting

PERL data - sorting

Hello, I have a page where multiple fields and their values are displayed. But I am able to sort only a few fields. When I looked into the issue, it is seen that the for each row of info , an unique id is generated and id.txt is generated and saved. Only those fields which are inside that id.txt... (3 Replies)
Discussion started by: eagercyber
3 Replies
Login or Register to Ask a Question
Gtk2::TreeSortable(3pm) 				User Contributed Perl Documentation				   Gtk2::TreeSortable(3pm)

NAME
Gtk2::TreeSortable - wrapper for GtkTreeSortable HIERARCHY
Glib::Interface +----Gtk2::TreeSortable METHODS
$sortable->set_default_sort_func ($sort_func, $user_data=undef) o $sort_func (scalar) o $user_data (scalar) boolean = $sortable->has_default_sort_func $sortable->sort_column_changed (sort_column_id, order) = $sortable->get_sort_column_id Returns sort_column_id, an integer and order, a Gtk2::SortType. $sortable->set_sort_column_id ($sort_column_id, $order) o $sort_column_id (integer) o $order (Gtk2::SortType) $sortable->set_sort_func ($sort_column_id, $sort_func, $user_data=undef) o $sort_column_id (integer) o $sort_func (scalar) o $user_data (scalar) IMPLEMENTING THE GtkTreeSortable INTERACE If you want your custom tree model to be sortable, you need to implement the GtkTreeSortable interface. Just like with other interfaces, this boils down to announcing that your subclass implements the interface and providing a few virtual methods. The former is achieved by adding "Gtk2::TreeSortable" to the "interfaces" key. For example: package MyModel; use Gtk2; use Glib::Object::Subclass Glib::Object::, interfaces => [ Gtk2::TreeModel::, Gtk2::TreeSortable:: ], ; The virtual methods you need to implement are listed below. VIRTUAL METHODS These virtual methods are called by perl when gtk+ attempts to modify the sorting behavior of your model. Implement them in your model's package. Note that we don't provide a wrapper for sort_column_changed because there is a signal for it, which means you can use the normal signal overriding mechanism documented in Glib::Object::Subclass. (is_not_special, id, order) = GET_SORT_COLUMN_ID ($model) Returns a boolean indicating whether the column is a special or normal one, its id and its sorting order. SET_SORT_COLUMN_ID ($list, $id, $order) Sets the sort column to the one specified by $id and the sorting order to $order. SET_SORT_FUNC ($list, $id, $func, $data) Sets the function that is to be used for sorting the column $id. SET_DEFAULT_SORT_FUNC ($list, $func, $data) Sets the function that is to be used for sorting columns that don't have a sorting function attached to them. The $func and $data arguments passed to these two methods should be treated as blackboxes. They are generic containers for some callback that is to be invoked whenever you want to compare two tree iters. When you call them, make sure to always pass $data. For example: $retval = $func->($list, $a, $b, $data); bool = HAS_DEFAULT_SORT_FUNC ($list) Returns a bool indicating whether $list has a default sorting function. SIGNALS
sort-column-changed (Gtk2::TreeSortable) ENUMS AND FLAGS
enum Gtk2::SortType o 'ascending' / 'GTK_SORT_ASCENDING' o 'descending' / 'GTK_SORT_DESCENDING' SEE ALSO
Gtk2, Glib::Interface COPYRIGHT
Copyright (C) 2003-2011 by the gtk2-perl team. This software is licensed under the LGPL. See Gtk2 for a full notice. perl v5.14.2 2012-05-27 Gtk2::TreeSortable(3pm)