Sponsored Content
Top Forums Shell Programming and Scripting How to sort list of directories in descending order in perl? Post 303042945 by Neo on Monday 13th of January 2020 04:14:17 AM
Old 01-13-2020
You should provide definitions of all variables, exactly to get the best solution / help:

Put in code what you say in your description, please.

For example, in your code fragment $wdir is defined where? What exact version of PERL are you running. For example:

Code:
macos$ perl --version

This is perl 5, version 18, subversion 4 (v5.18.4) built for darwin-thread-multi-2level
(with 2 registered patches, see perl -V for more detail)

Copyright 1987-2013, Larry Wall

You want us to assume that $wdir is correctly defined as your home directory, is that right?

Where do you say that in your post?

Please be precise and clear. Define all variable in your code. Details matter. Versions matter. Even OS can matter....

Anyway, assuming $wdir is your current working directory.... the perhaps you can benefit from this PERL page:

readdir - perldoc.perl.org
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to see disk usage in descending order

What is the command used by sysadmin to see the disk used by the users in descending order of their disk usage? (8 Replies)
Discussion started by: asutoshch
8 Replies

2. Shell Programming and Scripting

Ascending & Descending order numbers

Dear All, I have below attached file in which i have many nos, i want the last ascending order nos. The brief description is given below. File 315 381 432 315 381 432 315 381 432 315 381 432 315 381 432 (6 Replies)
Discussion started by: pravani1
6 Replies

3. UNIX for Dummies Questions & Answers

Help - Find command with list of files modified descending Order

Hi, I would like to know the command to get the files order in descending order with "FIND" command. Appreciate your help Thanks (4 Replies)
Discussion started by: TonySolarisAdmi
4 Replies

4. UNIX for Dummies Questions & Answers

how to list descending order

Hi, I want to short descending all the files according to their size.Please help me.. (1 Reply)
Discussion started by: jyotidas
1 Replies

5. Shell Programming and Scripting

How to list all the directories, sub directories in a mount along with size in ascending order?

Hi , I am very new to unix as well as shell scripting. I have to write a script for the following requirement. In a particular mount, have to list all the directories and sub directories along with size of the directory and sub directory in ascending order. Please help me in this regard and many... (4 Replies)
Discussion started by: nmakkena
4 Replies

6. Shell Programming and Scripting

Unable to get the correct sort order in perl.

Hi, I have created the hash. %hash; @arr1 = qw(Dealnum AdminStatus adminReason effFrom effTo); @arr2 = qw(121212121 YES 1992-06-19T05:14:27 ); @hash{@arr1}=@arr2; foreach(sort keys %hash){ print "$_ ---- $hash{$_}\n"; } The output i got like this: C:\strawberry\perl\bin>perl... (1 Reply)
Discussion started by: vanitham
1 Replies

7. Shell Programming and Scripting

Help with sort data based on descending order problem

Input file 9.99331e-13 8.98451e-65 9.98418e-34 7.98319e-08 365592 111669 74942.9 0 Desired output 365592 111669 74942.9 7.98319e-08 1.99331e-13 6.98418e-34 (2 Replies)
Discussion started by: perl_beginner
2 Replies

8. Shell Programming and Scripting

script for remove descending order number

hi all i want to remove some descending order number example : 1 100 200 135.00 Gk_wirs 1 1 100 200 136.00 Gk_wirs 50 1 110 210 138.00 Gk_wirs 60 1 100 200 136.00 Gk_wirs 57 ----> how to remove... (6 Replies)
Discussion started by: nithyanandan
6 Replies

9. Shell Programming and Scripting

Sort names in a list by order of importance

Hi, I have multiple list which is arranged by order of importance. I need to do sorting on these lists based on the last name of the user(initial), if user name does not have initial then first name is initial . Important thing is that the last name in the list is important. If there is two or... (1 Reply)
Discussion started by: pratapsingh
1 Replies

10. UNIX for Dummies Questions & Answers

Sorting a file in descending order when you have 10e- values

Hi, I am trying to sort the following file in descending order of its fourth column. 2 1 363828 -2.423225e-03 3 1 363828 4.132763e-03 3 2 363828 8.150133e-03 4 1 363828 4.126890e-03 I use sort -k4,4g -r input.txt > output.txt ... (1 Reply)
Discussion started by: evelibertine
1 Replies
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)
All times are GMT -4. The time now is 09:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy