Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

tie::array::sorted(3pm) [debian man page]

Tie::Array::Sorted(3pm) 				User Contributed Perl Documentation				   Tie::Array::Sorted(3pm)

NAME
Tie::Array::Sorted - An array which is kept sorted SYNOPSIS
use Tie::Array::Sorted; tie @a, "Tie::Array::Sorted", sub { $_[0] <=> $_[1] }; push @a, 10, 4, 7, 3, 4; print "@a"; # "3 4 4 7 10" DESCRIPTION
This presents an ordinary array, but is kept sorted. All pushes and unshifts cause the elements in question to be inserted in the appropri- ate location to maintain order. Direct stores ("$a[10] = "wibble"") effectively splice out the original value and insert the new element. It's not clear why you'd want to use direct stores like that, but this module does the right thing if you do. If you don't like the ordinary lexical comparator, you can provide your own; it should compare the two elements it is given. For instance, a numeric comparator would look like this: tie @a, "Tie::Array::Sorted", sub { $_[0] <=> $_[1] } Whereas to compare a list of files by their sizes, you'd so something like: tie @a, "Tie::Array::Sorted", sub { -s $_[0] <=> -s $_[1] } LAZY SORTING
If you do more stores than fetches, you may find Tie::Array::Sorted::Lazy more efficient. AUTHOR
Original author: Simon Cozens Current maintainer: Tony Bowden BUGS and QUERIES Please direct all correspondence regarding this module to: bug-Tie-Array-Sorted@rt.cpan.org This module was originall written as part of the Plucene project. However, as Plucene no longer uses this, it is effectively unmaintained. COPYRIGHT AND LICENSE
Copyright (C) 2003-2006 Simon Cozens and Tony Bowden. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. perl v5.8.8 2004-10-10 Tie::Array::Sorted(3pm)

Check Out this Related Man Page

Tie::ToObject(3pm)					User Contributed Perl Documentation					Tie::ToObject(3pm)

NAME
Tie::ToObject - Tie to an existing object. SYNOPSIS
use Tie::ToObject; my $stolen = tied(%something); tie %something_else, 'Tie::ToObject', $stolen; DESCRIPTION
While "tie" in perldoc allows tying to an arbitrary object, the class in question must support this in it's implementation of "TIEHASH", "TIEARRAY" or whatever. This class provides a very tie constructor that simply returns the object it was given as it's first argument. This way side effects of calling "$object->TIEHASH" are avoided. This is used in Data::Visitor in order to tie a variable to an already existing object. This is also useful for cloning, when you want to clone the internal state object instead of going through the tie interface for that variable. VERSION CONTROL
This module is maintained using Darcs. You can get the latest version from <http://nothingmuch.woobling.org/code>, and use "darcs send" to commit changes. AUTHOR
Yuval Kogman <nothingmuch@woobling.org> COPYRIGHT
Copyright (c) 2008 Yuval Kogman. All rights reserved This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.3 2008-01-17 Tie::ToObject(3pm)
Man Page

15 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Array Retrieval Formatting

I have a shell script (Solaris v8 ksh) loading an array from a flat file. An exaple of that flat file is below. It contains white-spaces, and carrage returns. When I try to load the first line as a variable, it (the variable) shows up as the first field not the first line. How do you arrange an... (9 Replies)
Discussion started by: gozer13
9 Replies

2. Solaris

Array's example

Array's example :) Hi all, Since Iam learning the usage of Unix scripting, can any one provide some array examples (Simple to complex)? With Regards, Love (Jennifer) (5 Replies)
Discussion started by: Love
5 Replies

3. Shell Programming and Scripting

Array question

Hi all, I have a question does anyone know if it is possible to push or pop an array in the ksh environment? Could anyone give me a hint, because I am trying to merge 2 server files together and there are some names in the server is not proper anymore. Thank you in advance. (4 Replies)
Discussion started by: ahtat99
4 Replies

4. Programming

CHAR Array - stuffed with values - with more size than it holds

Hi All I am simulating a problem in the production where i faced a situation. Please find the following example program which i simulated. #include<stdio.h> #include<stdlib.h> #include<string.h> int main() { char str1; (3 Replies)
Discussion started by: dhanamurthy
3 Replies

5. Shell Programming and Scripting

compare/match arrays

Hi there all, I am having a question. Is it posible to compare elements of 2 different arrays? For example I got Array 1 | Array 2 123_abc | 123_bcd 123_bcd | 234_bcd 234_abc | 567_abc 234_bcd | 123_abc than the match is 123_abc & 234_bcd and non of the others. So... (3 Replies)
Discussion started by: draco
3 Replies

6. Shell Programming and Scripting

Compare Array results

Hi, In a kshell , i need to compare the results of two array . each Non-match value should copy to a new array. For example: ========== Array one contain the following values: A B C Array two contain the following values: C F A E After comparing this arrays , a new array should... (4 Replies)
Discussion started by: yoavbe
4 Replies

7. Shell Programming and Scripting

how to remove characters from a string

Hi. for the following line: Var1=${Array} now Array has text as "{hello there}" how do I remove the {} brackets before assigning the string to Var1? Thanks. (3 Replies)
Discussion started by: shadow_boi
3 Replies

8. UNIX for Advanced & Expert Users

Sorted file

Hi Is there any unix shell command or utility to know if the file is sorted or not? Thanks (3 Replies)
Discussion started by: ksailesh
3 Replies

9. Shell Programming and Scripting

Sorted list by time of spu processing

Hi, i have to make a command in unix system which make a sorted list by cpu time (not %cpu ). If the application exists more than a time I would like to keep only one copy. Could you help me please ??? P.s : I am trying --> ps aux --sort -%cpu | uniq but I understand that is wrong (5 Replies)
Discussion started by: petros55
5 Replies

10. Shell Programming and Scripting

Search Files from Array and link to original location in Perl

Hello, Question is related to Perl: I need to search few of the files from the array of file names. And after grepping the file names from an array I need to link these files to original location. The original location in this case is ref_path as input from the user. ##$ref_path is... (3 Replies)
Discussion started by: aarora1
3 Replies

11. Shell Programming and Scripting

Help with manipulating Array in Perl

I am new in perl .... I defined Array in Perl which contain values as below: Array name: @TEST sample values : when I print Array: print " @test \n"; <title>0008857661</title> <title>0009841171</title> <title>0010161261</title> <title>0010230023</title> I want to get only these... (7 Replies)
Discussion started by: gdubey
7 Replies

12. Shell Programming and Scripting

Passing argument 1 of 'scanf' makes po

$ cc Array.c Array.c: In function ‘main’: Array.c:23: warning: passing argument 1 of ‘scanf’ makes po Array.c:25: error: expected expression before ‘return’ Array.c:29: error: expected expression before ‘return’ Array.c: At top level: Array.c:44: error: expected ‘)’ before ‘&’ token... (8 Replies)
Discussion started by: sgradywhite
8 Replies

13. Shell Programming and Scripting

Arrays in awk

Array A contains lines of numbers from files. Array B contains number of fields for each line of each file. I want to run on array A. To do that I need to know the number of fields for each file in array A (because each line doesn't have the same NF). The NF is in array B, problem is: I don't... (6 Replies)
Discussion started by: guitarist684
6 Replies

14. UNIX for Dummies Questions & Answers

Array inside sed

Hi guys Let me at first describe the whole thing that I'm trying to do. Lets say I have 100 files like the following one. Ow 1230 16.000000 -0.834000 16.083957 1.751652398 -17.20094528 -4.450623277 Hw 1231 ... (6 Replies)
Discussion started by: saleheen
6 Replies

15. Shell Programming and Scripting

Question on iterating array elements

Hi, I am trying to do something similar to the for loop example from KSH For Loop Array: Iterate Through Array Values $: cat y.ksh #!/bin/ksh # set array called nameservers set -A nameservers 192.168.1.1 192.168.1.5 202.54.1.5 # print all name servers for i in ${nameservers} do ... (3 Replies)
Discussion started by: newbie_01
3 Replies