i'm halfway into my script and realize i may need to use an associative array (a hash, i guess they are called in Perl). i'm fairly new to Perl and don't know how to use them correctly.
i have some files in a directory. each file contains a number in a specific place in it's header. what i would... (4 Replies)
I have many files that I need to sort each week. I know how to do in Unix, but for this task it appears best to do native inside an existing perl program. So, simplified, I have a file similar to the following:
Joe_________12_Main_St__A001________LX
Benny_______5_Spring____A002________LX... (5 Replies)
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)
I have an array full of string values that need to be sorted, but if a value starts with (regex) 0^ it should be at the beginning of the array. Otherwise the array should be sorted normally using ascii sort.
Please help me create the sub to pass to the sort function. (7 Replies)
Hi All,
I have an array in perl as @match = (201001,201002,201001,201002);
I am trying to sort this array as
@match = sort(@match);
print "@match";
I dont see the output sorted any answers
I also tried another way, but still the results are not sorted
foreach my $match (sort { $a... (2 Replies)
Hi,
I have a file in this format:
a b c d e
a b c d e
a b c d e
i need perl script to sort 2nd column in alphabatical order
The script i use is
#!/usr/bin/perl
my @words=<>;
foreach(sort mysort @words) {
print; (4 Replies)
Good morning!!
Im trying to practice withe Perl and sorting variables is not going good at all!
#!/usr/bin/perl
$username = $ENV {'LOGNAME'};
print "Hello, $username\n";
I want to add sort and 'mail' and 'home'. This below is what I have came up with,but of course its not working.
... (5 Replies)
I have a file abc.txt which contains data in th following format
abc,23
hgfh,87
tweg,89
jdfjn,74
I want to sort on the basis of column (the second one). It should be numerical sort.
output should be
abc,23
jdfjn,74
hgfh,87
tweg,89
I know how to do it in unix. I need a PERL code (1 Reply)
Hi all,
Not sure if this should be in the programming forum, but I believe it will get more response under the Shell Programming and Scripting FORUM.
Am trying to write a customized df script in Perl and need some help with regards to using arrays and file handlers.
At the moment am... (3 Replies)
I have a directory of backup files.
named like this:
ldap.data.04-06-2012.tar
ldap.data.03-06-2012.tar
ldap.data.02-06-2012.tar
ldap.data.01-06-2012.tar
ldap.data.31-05-2012.tar
ldap.data.30-05-2012.tar
ldap.data.29-05-2012.tar
ldap.data.28-05-2012.tar
ldap.data.27-05-2012.tar... (6 Replies)
Discussion started by: robsonde
6 Replies
LEARN ABOUT SUSE
tap::parser::multiplexer
TAP::Parser::Multiplexer(3pm) Perl Programmers Reference Guide TAP::Parser::Multiplexer(3pm)NAME
TAP::Parser::Multiplexer - Multiplex multiple TAP::Parsers
VERSION
Version 3.17
SYNOPSIS
use TAP::Parser::Multiplexer;
my $mux = TAP::Parser::Multiplexer->new;
$mux->add( $parser1, $stash1 );
$mux->add( $parser2, $stash2 );
while ( my ( $parser, $stash, $result ) = $mux->next ) {
# do stuff
}
DESCRIPTION
"TAP::Parser::Multiplexer" gathers input from multiple TAP::Parsers. Internally it calls select on the input file handles for those
parsers to wait for one or more of them to have input available.
See TAP::Harness for an example of its use.
METHODS
Class Methods
"new"
my $mux = TAP::Parser::Multiplexer->new;
Returns a new "TAP::Parser::Multiplexer" object.
Instance Methods
"add"
$mux->add( $parser, $stash );
Add a TAP::Parser to the multiplexer. $stash is an optional opaque reference that will be returned from "next" along with the parser and
the next result.
"parsers"
my $count = $mux->parsers;
Returns the number of parsers. Parsers are removed from the multiplexer when their input is exhausted.
"next"
Return a result from the next available parser. Returns a list containing the parser from which the result came, the stash that corresponds
with that parser and the result.
my ( $parser, $stash, $result ) = $mux->next;
If $result is undefined the corresponding parser has reached the end of its input (and will automatically be removed from the multiplexer).
When all parsers are exhausted an empty list will be returned.
if ( my ( $parser, $stash, $result ) = $mux->next ) {
if ( ! defined $result ) {
# End of this parser
}
else {
# Process result
}
}
else {
# All parsers finished
}
See Also
TAP::Parser
TAP::Harness
perl v5.12.1 2010-04-26 TAP::Parser::Multiplexer(3pm)