Shlomi Fish wrote:
"Wagner, David --- Sr Programmer Analyst --- CFS"
wrote:
Since a \n is at end, then could use split like:
for my $dtl ( sort {$a<=> $b} split(/\n/, $a_string) ) {
One can also do split(/^/m, $a_string) to split into lines while preserving the
newlines.
It wi
Hi,
On Tue, 16 Aug 2011 11:09:35 -0500
"Wagner, David --- Sr Programmer Analyst --- CFS"
wrote:
> >-Original Message-
> >From: Matt [mailto:lm7...@gmail.com]
> >Sent: Tuesday, August 16, 2011 10:04
> >To: beginners@perl.org
> >Subject: Sorting a String
> >
> >I believe you can sort an ar
>-Original Message-
>From: Matt [mailto:lm7...@gmail.com]
>Sent: Tuesday, August 16, 2011 10:04
>To: beginners@perl.org
>Subject: Sorting a String
>
>I believe you can sort an array like so:
>
>sort @my_array;
>
>I need to sort a string though.
>
>I have $a_string that contains:
>
>4565 lin
Matt wrote:
I believe you can sort an array like so:
sort @my_array;
That should be:
@my_array = sort @my_array;
I need to sort a string though.
I have $a_string that contains:
4565 line1
2345 line2
500 line3
etc.
Obviously \n is at end of every line in the string. I need it sorted.
On Tue, Aug 16, 2011 at 12:04 PM, Matt wrote:
> I believe you can sort an array like so:
>
> sort @my_array;
>
> I need to sort a string though.
>
> I have $a_string that contains:
>
> 4565 line1
> 2345 line2
> 500 line3
> etc.
>
> Obviously \n is at end of every line in the string. I need it sor
sort like string or like numbers?
On Tue, Aug 16, 2011 at 18:04, Matt wrote:
> I believe you can sort an array like so:
>
> sort @my_array;
>
> I need to sort a string though.
>
> I have $a_string that contains:
>
> 4565 line1
> 2345 line2
> 500 line3
> etc.
>
> Obviously \n is at end of every li
On Mon, Aug 8, 2011 at 10:10, Paul Johnson wrote:
> On Mon, Aug 08, 2011 at 09:25:48AM -0400, shawn wilson wrote:
>> On Aug 8, 2011 12:11 AM, "Ramprasad Prasad" wrote:
>> >
>> > Using the system linux sort ... Does not help.
>> > On my dual quad core machine , (8 gb ram) sort -n file takes 10
>>
On 11-08-08 10:23 AM, Shlomi Fish wrote:
I suggest splitting the files into bins. Each bin will contain the records with
the batch numbers in a certain range (say 0-999,999 ; 1,000,000-1,999,999,
etc.). You should select the bins so the numbers are spread more or less
evenly. Then you sort each b
Hi Ramprasad,
On Sun, 7 Aug 2011 20:58:14 +0530
Ramprasad Prasad wrote:
> I have a file that contains records of customer interaction
> The first column of the file is the batch number(INT) , and other columns
> are date time , close time etc etc
>
> I have to sort the entire file in order of t
On Mon, Aug 08, 2011 at 09:25:48AM -0400, shawn wilson wrote:
> On Aug 8, 2011 12:11 AM, "Ramprasad Prasad" wrote:
> >
> > Using the system linux sort ... Does not help.
> > On my dual quad core machine , (8 gb ram) sort -n file takes 10
> > minutes and in the end produces no output.
>
> I had a
On Aug 8, 2011 12:11 AM, "Ramprasad Prasad" wrote:
>
> Using the system linux sort ... Does not help.
> On my dual quad core machine , (8 gb ram) sort -n file takes 10
> minutes and in the end produces no output.
>
I had a smaller file and 32g to play with on a dual quad core (dl320). Sort
just c
On Mon, Aug 08, 2011 at 10:40:12AM +0530, Ramprasad Prasad wrote:
> Using the system linux sort ... Does not help.
> On my dual quad core machine , (8 gb ram) sort -n file takes 10
> minutes and in the end produces no output.
Did you set any other options?
At a minimum you should set -T to tell
On Sun, Aug 7, 2011 at 22:10, Ramprasad Prasad wrote:
>
[snip]
> I guess there is a serious need for re-architecting , rather than
> create such monstrous files, but when people work with legacy systems
> which worked fine when there was lower usage and now you tell then you
> need a overhaul be
Using the system linux sort ... Does not help.
On my dual quad core machine , (8 gb ram) sort -n file takes 10
minutes and in the end produces no output.
when I put this data in mysql , there is an index on the order by
field ... But I guess keys don't help when you are selecting the
entire table.
> "RP" == Rajeev Prasad writes:
RP> hi, you can try this: first get only that field (sed/awk/perl)
RP> whihc you want to sort on in a file. sort that file which i assume
RP> would be lot less in size then your current file/table. then run a
RP> loop on the main file using sorted file
On Sun, Aug 7, 2011 at 15:58, Rob Dixon wrote:
> On 07/08/2011 20:30, Shawn H Corey wrote:
>>
>> On 11-08-07 03:20 PM, shawn wilson wrote:
>>>
>>> It can be sped up (slightly) with an index.
>>
>> Indexes in SQL don't normally speed up sorting. What they're best at is
>> selecting a limited number
On 07/08/2011 20:30, Shawn H Corey wrote:
On 11-08-07 03:20 PM, shawn wilson wrote:
It can be sped up (slightly) with an index.
Indexes in SQL don't normally speed up sorting. What they're best at is
selecting a limited number of records, usually less than 10% of the
total. Otherwise, they ju
On 11-08-07 03:20 PM, shawn wilson wrote:
It can be sped up (slightly) with an index.
Indexes in SQL don't normally speed up sorting. What they're best at is
selecting a limited number of records, usually less than 10% of the
total. Otherwise, they just get in the way.
The best you can do
On Aug 7, 2011 1:15 PM, "Paul Johnson" wrote:
>
> On Sun, Aug 07, 2011 at 08:58:14PM +0530, Ramprasad Prasad wrote:
>
> > I have a file that contains records of customer interaction
> > The first column of the file is the batch number(INT) , and other
columns
> > are date time , close time etc etc
On Sun, Aug 07, 2011 at 08:58:14PM +0530, Ramprasad Prasad wrote:
> I have a file that contains records of customer interaction
> The first column of the file is the batch number(INT) , and other columns
> are date time , close time etc etc
>
> I have to sort the entire file in order of the first
print $}' > tmp-file
sort
for id in `cat `;do grep $id >>
sorted-large-file;done
From: Ramprasad Prasad
To: Shawn H Corey
Cc: Perl Beginners
Sent: Sunday, August 7, 2011 11:01 AM
Subject: Re: Sorting an extremely LARGE file
On 7 August 2011 21:24, Shawn H Corey wrote:
>
On 2011-08-07 17:28, Ramprasad Prasad wrote:
I have a file that contains records of customer interaction
The first column of the file is the batch number(INT) , and other columns
are date time , close time etc etc
I have to sort the entire file in order of the first column .. but the
problem is
On 7 August 2011 21:24, Shawn H Corey wrote:
> On 11-08-07 11:46 AM, Ramprasad Prasad wrote:
>
>> I used a mysql database , but the order by clause used to hang the
>> process indefinitely
>> If I sort files in smaller chunks how can I merge them back ??
>>
>>
> Please use "Reply All" when respon
On 11-08-07 11:46 AM, Ramprasad Prasad wrote:
I used a mysql database , but the order by clause used to hang the
process indefinitely
If I sort files in smaller chunks how can I merge them back ??
Please use "Reply All" when responding to a message on this list.
You need two temporary files a
On 11-08-07 11:28 AM, Ramprasad Prasad wrote:
I have a file that contains records of customer interaction
The first column of the file is the batch number(INT) , and other columns
are date time , close time etc etc
I have to sort the entire file in order of the first column .. but the
problem is
On 01/02/2011 14:02, Chris Stinemetz wrote:
#!/usr/bin/perl
use warnings;
use strict;
use IO::Handle;
RAW->format_lines_per_page(100); # I will change this once I get strict
pragma to work.
format RAW_TOP =
@|||
I bottom posted. Any help is greatly appreciated.
Chris
-Original Message-
From: Chris Stinemetz [mailto:cstinem...@cricketcommunications.com]
Sent: Tuesday, February 01, 2011 8:03 AM
To: Shlomi Fish; beginners@perl.org
Subject: RE: sorting report
Shlomi,
See far bottom for my
Shlomi,
See far bottom for my updated code.
Chris Stinemetz
-Original Message-
From: Shlomi Fish [mailto:shlo...@iglu.org.il]
Sent: Tuesday, February 01, 2011 4:18 AM
To: beginners@perl.org
Cc: Chris Stinemetz
Subject: Re: sorting report
Hi Chris,
a few comments on your code:
On
Hi Chris,
a few comments on your code:
On Tuesday 01 Feb 2011 06:43:43 Chris Stinemetz wrote:
> I would like to sort my final report in the following order:
>
> $data[31],$data[32],$data[38]
>
> How would I add this into my following program to get the report sorted
> this way?
>
> Thanks in a
> On Dec 1, 7:31 am, jwkr...@shaw.ca ("John W. Krahn") wrote:
>
> Correction:
>
> my @sorted_files_in_directory =
> map $_->[ 1 ],
> sort { $a->[ 0 ] <=> $b->[ 0 ] }
> map { ( stat "$directory_name/$_" )[ 9 ], $_ }
map { [ ( stat "$directory_name/$_" )[ 9 ], $_ ] }
>
On Wednesday 01 December 2010 16:57:07 John W. Krahn wrote:
> Amit Saxena wrote:
> > Hi all,
> > {
> >
> > next if ( ( $filename eq "." ) or ( $filename eq ".." ) );
> >
> > push ( @files_in_directory, $filename );
> >
> > }
>
> Since all you are doing is populating t
On 10-12-01 09:57 AM, John W. Krahn wrote:
Or just:
print map( "$_\n", @files_in_directory ), "\n";
print map( "$_\n", @sorted_files_in_directory ), "\n";
--
Just my 0.0002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
John W. Krahn wrote:
Amit Saxena wrote:
my @sorted_files_in_directory;
@sorted_files_in_directory = sort { (stat($a))[9]<=> (stat($b))[9] }
If you read the documentation for readdir you will see where it says:
If you're planning to filetest the return values out of a
"readdir", you'd better
Amit Saxena wrote:
Hi all,
Hello,
The following perl program, for sorting files in a directory, without using
any OS specific command, ordered by modified timestamp is not working.
Please help.
*Perl Program*
#!perl.exe
use strict;
use warnings;
my $directory_name;
print "This program pr
On 10-12-01 07:19 AM, Amit Saxena wrote:
print "Sorted listing of files in<$directory_name> directory are as follows
:-\n";
my $j;
foreach $j ( @files_in_directory )
foreach $j ( @sorted_files_in_directory )
{
print $j . "\n";
}
print "\n";
--
Just my 0.0002 million dollars w
On Jun 20, 1:39 am, philg...@yahoo.com (philge philip) wrote:
> hi
>
> can someone tell me how i can sort by keys from a hash (huge data) stored in
> a DB_File?
>
You might try a merge-sort - check CPAN.
Another possibility: re-write the existing DB_File
to use a DB_Tree format which by default
Many thanks to Scott, Shawn, Paul, Jenda, and Uri. I've learned
something from each of you, and appreciate your taking the time to help!
Rick
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
From: Shawn H Corey
> Jenda Krynicky wrote:
> > ST is an overkill if the extraction is simple.
> >
> > Especially if the number of items is fairly small.
> >
> > Actually if the extraction is really simple and the extracted key is
> > not so small, than ST may perform worse than an ordinary so
>-Original Message-
>From: Rick Triplett [mailto:r...@reason.net]
>Sent: Tuesday, October 13, 2009 12:09 PM
>To: Perl Beginners
>Subject: Sorting mixed alphanumerics
>
>I need to sort the keys in a hash. The keys are the question number
>and the values are the student's answer. A numeric s
> "SHC" == Shawn H Corey writes:
SHC> Jenda Krynicky wrote:
>> ST is an overkill if the extraction is simple.
>>
>> Especially if the number of items is fairly small.
>>
>> Actually if the extraction is really simple and the extracted key is
>> not so small, than ST may perf
Jenda Krynicky wrote:
> ST is an overkill if the extraction is simple.
>
> Especially if the number of items is fairly small.
>
> Actually if the extraction is really simple and the extracted key is
> not so small, than ST may perform worse than an ordinary sort doing
> the extraction within t
Date sent: Wed, 14 Oct 2009 11:03:13 -0400
From: Shawn H Corey
To: Rick Triplett
Copies to: Perl Beginners
Subject:Re: Sorting mixed alphanumerics
> Rick Triplett wrote:
> > I need to sort the keys in a
On Tue, Oct 13, 2009 at 11:09:09AM -0500, Rick Triplett wrote:
> I need to sort the keys in a hash. The keys are the question number and
> the values are the student's answer. A numeric sort with <=> won't work
> since retaking a missed question (say, 2) produces the new key, 2h with
> its new a
Rick Triplett wrote:
> I need to sort the keys in a hash. The keys are the question number and
> the values are the student's answer. A numeric sort with <=> won't work
> since retaking a missed question (say, 2) produces the new key, 2h with
> its new answer. A representative hash might look like
On Wed, Jul 8, 2009 at 15:09, "Alexander
Müller" wrote:
> Hi,
>
> I need an order for hash by user preferences. Because the criterion to order
> the hash entries a not numerical and not should sorted alphabetical, I tried
> following
>
>
> 3 %hashToSort = (
> 4 "a" => "one",
> 5 "b"
On 7/2/09 Thu Jul 2, 2009 12:12 PM, "daem0n...@yahoo.com"
scribbled:
>
> Hi,
>
> If I have a loop that for each run creates
>
> while (){
> my $value =~ /^\d/;
> $myhash{$mykey}->{'subkey'} = $value;
> }
>
>
> Normally, if I only want to sort $myhash through it's values, I would do
> s
Anirban Adhikary wrote:
> Dear list
> I want to sort a file which contains the following data.
>
> SUDIP,PQR,OFFICER,15000
> DIPAK,ABC,CLERK,7500
> CHANDAN,MNP,MANAGER,12000
> WASIM,PQR,CLERK,12000
> PROTIK,XYZ,MANAGER,14000
> DIPAK,XYZ,ADMIN,17000
>
>
> now I have written a program which will s
Christopher Yee Mon wrote:
> I have an array of strings whose members consist of a number followed by
> a comma followed by a text string
>
> e.g.
> 1,fresh
> 2,testurl
>
> I want to sort by descending numerical order according to the number
> part so I made this sort subroutine
>
> sub by_cou
hmm. i just tried it and it worked. I guess it's one of those situations.
thanks
Christopher
John W. Krahn wrote:
> Christopher Yee Mon wrote:
>> I have an array of strings whose members consist of a number followed
>> by a comma followed by a text string
>>
>> e.g.
>> 1,fresh
>> 2,testurl
>>
>>
On Mon, 2008-12-15 at 20:33 -0500, Christopher Yee Mon wrote:
> I have an array of strings whose members consist of a number followed by
> a comma followed by a text string
>
> e.g.
> 1,fresh
> 2,testurl
>
> I want to sort by descending numerical order according to the number
> part so I made t
Brian Tillman wrote:
I'm probably missing something, but what's wrong with?:
sort {$b <=> $a} @array;
Nothing, unless you have, as you really should, warnings enabled:
$ perl -le'
use warnings;
my @array = ( "1,fresh", "2,testurl" );
@array = sort { $b <=> $a } @array;
print for @array;
'
Arg
well if the contents of the array are '1,fresh' and '2,testurl' I think
that'll try to do a numerical sort on the pair of strings which wouldn't
do anything. I have tried { $b <=> $a } and it didn't work.
I want the sort to take the two strings and sort the strings but only
sort by the numerical p
Christopher Yee Mon wrote:
I have an array of strings whose members consist of a number followed by
a comma followed by a text string
e.g.
1,fresh
2,testurl
I want to sort by descending numerical order according to the number
part so I made this sort subroutine
sub by_counter_field {
my($a
I'm probably missing something, but what's wrong with?:
sort {$b <=> $a} @array;
On Dec 15, 2008, at 6:33 PM, Christopher Yee Mon > wrote:
I have an array of strings whose members consist of a number
followed by a comma followed by a text string
e.g.
1,fresh
2,testurl
I want to sort by
Gunwant Singh wrote:
> Rob Dixon wrote:
>>
>> my @sorted = sort {
>> my @a = split /:/, $a;
>> my @b = split /:/, $b;
>> $a[1] <=> $b[1];
>> } @list;
>>
>> print "$_\n" foreach @sorted;
>
> I got what your code says.Thanks a lot!!
> Can you tell me what is $a[1] <=> $b[1] doing for me?
It co
Rob Dixon wrote:
Gunwant Singh wrote:
Hi all,
I really appreciate all you guys there for the help you've provided to
me in the past.
So here I am again with a Question.
I have a file with the following entries:
1:17
4:3
4:11
4:13
11:16
12:10
13:2
19:5
20:7
26:12
28:4
33:15
33:17
35:9
36:
Gunwant Singh wrote:
> Hi all,
>
> I really appreciate all you guys there for the help you've provided to
> me in the past.
> So here I am again with a Question.
>
> I have a file with the following entries:
>
> 1:17
> 4:3
> 4:11
> 4:13
> 11:16
> 12:10
> 13:2
> 19:5
> 20:7
> 26:12
> 28:4
> 33:1
On Sun, 2008-08-03 at 01:53 +0530, Gunwant Singh wrote:
> Hi all,
>
> I really appreciate all you guys there for the help you've provided to
> me in the past.
> So here I am again with a Question.
>
> I have a file with the following entries:
>
> 1:17
> 4:3
> 4:11
> 4:13
> 11:16
> 12:10
> 13:2
On Mon, 2008-06-02 at 11:53 -0700, Iain Adams wrote:
> Hello,
>
> I am trying to sort a hash of hashes.
>
> my code looks like this
>
> foreach $cnt (sort keys %{ $relations{ $uid }{ "instances" } }){
> print OUT "$cnt 1, ";
> }
>
> This prints out the correct numbers (the keys
On Jun 2, 8:43 pm, [EMAIL PROTECTED] (Jialin Li) wrote:
> On Mon, Jun 2, 2008 at 1:53 PM, Iain Adams <[EMAIL PROTECTED]> wrote:
> > Hello,
>
> > I am trying to sort a hash of hashes.
>
> > my code looks like this
>
> > foreach $cnt (sort keys %{ $relations{ $uid }{ "instances" } }){
> >
Iain Adams wrote:
> Hello,
>
> I am trying to sort a hash of hashes.
>
> my code looks like this
>
> foreach $cnt (sort keys %{ $relations{ $uid }{ "instances" } }){
> print OUT "$cnt 1, ";
> }
>
> This prints out the correct numbers (the keys of the instances hash.
> However the
On Mon, Jun 2, 2008 at 1:53 PM, Iain Adams <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I am trying to sort a hash of hashes.
>
> my code looks like this
>
> foreach $cnt (sort keys %{ $relations{ $uid }{ "instances" } }){
> print OUT "$cnt 1, ";
> }
>
> This prints out the correct number
On Thu, May 15, 2008 at 12:13 PM, ANJAN PURKAYASTHA <
[EMAIL PROTECTED]> wrote:
> Hi,
> here is a problem I'm working on. It's not PERL-specific, rather it is a
> problem in sorting followed by grouping.
> Suppose I have a set of lines that have tab-delimited text, thus:
> 1 w 3 wer
> 2 a
On 9/10/07, Jeremy Kister <[EMAIL PROTECTED]> wrote:
> I am trying to optimize some sorting code I have. The data structure is
> as follows:
>
> my %hash = (x => [ 'a','b','c' ],
> y => [ 'd','e' ],
> z => [ 'f' ],
> );
>
>
> The result I expect is simply the
On 9/10/2007 5:13 PM, Rob Dixon wrote:
use List::Util qw/max/;
my %hash = (x => [ 'a','b','c' ],
y => [ 'd','e' ],
z => [ 'f' ],
);
my $most = max map scalar @$_, values %hash;
Woah! That's fast! :)
thanks,
--
Jeremy Kister
http://jeremy.kister.net./
--
Jeremy Kister wrote:
I am trying to optimize some sorting code I have. The data structure is
as follows:
my %hash = (x => [ 'a','b','c' ],
y => [ 'd','e' ],
z => [ 'f' ],
);
The result I expect is simply the highest number of elements. In this
case, the
On 9/10/2007 4:45 PM, Jeremy Kister wrote:
if(@{$hash{$key}} > $highest){
oops, that's if(@{$hash{$key}} > $most){
not $highest.
--
Jeremy Kister
http://jeremy.kister.net./
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.
Thanks Jeff, thanks Rob.
I used your solution Jeff and it's working a treat.
Cheers,
Nigel
Rob Dixon wrote:
Nigel Peck wrote:
Hi,
I have a list containing the names of all items in a directory. I want
to sort it by non-directories first and then directories, with a
secondary sort in alph
Nigel Peck wrote:
>
> Hi,
Hello,
> I have a list containing the names of all items in a directory. I want
> to sort it by non-directories first and then directories, with a
> secondary sort in alphabetical order.
>
> I currently have:
>
>
> my @items = sort {
>
Nigel Peck wrote:
Hi,
I have a list containing the names of all items in a directory. I want
to sort it by non-directories first and then directories, with a
secondary sort in alphabetical order.
I currently have:
my @items = sort {
my $a_path = $a
I'm sorry that just be clear you want the non-directory first,then
simply change the codes to:
my @items = map { $_->[0] }
sort { $a->[1] <=> $b->[1] or $a->[0] cmp $b->[0] }
map { -d $_ ? [$_,1] : [$_,0] } readdir DIR;
2007/4/27, Jeff Pang <[EMAIL PROTECTED]>:
2007/4/27,
2007/4/27, Nigel Peck <[EMAIL PROTECTED]>:
Hi,
I have a list containing the names of all items in a directory. I want
to sort it by non-directories first and then directories, with a
secondary sort in alphabetical order.
Hello,
I've tested, this could work for you.
my @items = map { $_->[0]
John W. Krahn wrote:
> Igor Sutton Lopes wrote:
>>
>>sub move_file {
>>
>># using -M is better than doing the calculation to obtain the
>>difference
>># from now and three days ago.
>>return unless -M $_ < 3;
>
> Why not just use the modified( '>3' ) rule?
Ok, modified( '>3' ) won't
On 4/10/07, John W. Krahn <[EMAIL PROTECTED]> wrote:
Igor Sutton Lopes wrote:
snip
> return unless -M $_ < 3;
Why not just use the modified( '>3' ) rule?
snip
There doesn't seem to be a performance issue either way:
Raterule explict
rule450/s -- -0%
explict 450/s
Igor Sutton Lopes wrote:
> Sorry! I was testing and sent the last version -TextMate integrated
> with Mail.app- :-(
>
> On Apr 10, 2007, at 4:40 PM, John W. Krahn wrote:
>
>> [...]
>> Did you test this? Where do you distinguish between files "older
>> than 3 days"
>> and other files? Where is
Sorry! I was testing and sent the last version -TextMate integrated
with Mail.app- :-(
On Apr 10, 2007, at 4:40 PM, John W. Krahn wrote:
[...]
Did you test this? Where do you distinguish between files "older
than 3 days"
and other files? Where is "name('trunk')" specified by the OP?
Th
Igor Sutton Lopes wrote:
>
> On Apr 10, 2007, at 3:27 PM, John W. Krahn wrote:
>
>> Craig Schneider wrote:
>>
>>> How could I exec a 'dir' command on a dos system and put the output in
>>> an array, sort by date and the files that are older than 3 days be
>>> moved into a folder called 'history
Hi,
On Apr 10, 2007, at 3:27 PM, John W. Krahn wrote:
Craig Schneider wrote:
Hi Guys
Hello,
How could I exec a 'dir' command on a dos system and put the
output in
an array, sort by date and the files that are older than 3 days be
moved
into a folder called 'history'
# open the curre
Craig Schneider wrote:
> Hi Guys
Hello,
> How could I exec a 'dir' command on a dos system and put the output in
> an array, sort by date and the files that are older than 3 days be moved
> into a folder called 'history'
# open the current directory
opendir my $dh, '.' or die "Cannot open '.' $
Hi,
If you wish to select all files that are directly under given directory you can
implement the following (in pure perl fashion):
sub numerically { $b <=> $a;}
$DIR = ;
$THRESHOLD_IN_DAYS = 3;
my %time_to_file;
my $currTime = time();
#Store all file in hash with time as key.
for each my $
On Tue, 2007-04-10 at 13:19 +0200, Craig Schneider wrote:
> Hi Guys
>
> How could I exec a 'dir' command on a dos system and put the output in
> an array, sort by date and the files that are older than 3 days be moved
> into a folder called 'history'
Look at module File::Find this should be abl
Don't know much about dos.
But under unix you may got the files older than 3 days by this way,
chdir '/the/path';
@files = grep { time - (stat)[9] > 24*60*60*3 } glob "*";
2007/4/10, Craig Schneider <[EMAIL PROTECTED]>:
Hi Guys
How could I exec a 'dir' command on a dos system and put the out
> ""Mumia" == "Mumia W " writes:
"Mumia> On 03/13/2007 07:44 PM, Hardly Armchair wrote:
>> Hello List,
>> I have a data structure containing a bunch of strings in different groups:
>> [...]
>> I want these sorted first alphabetically within the group, and then
>> according to the number of me
On 03/13/2007 07:44 PM, Hardly Armchair wrote:
Hello List,
I have a data structure containing a bunch of strings in different groups:
[...]
I want these sorted first alphabetically within the group, and then
according to the number of member in the group.
[...]
This is slightly more compact
Hardly Armchair wrote:
> Hello List,
Hello,
> I have a data structure containing a bunch of strings in different groups:
>
> $groups = [
> [
> 'SSPDQR',
> 'SSPSDR',
> 'STSSER',
> ],
> [
> 'CSANLH',
>
Yes! It was exactly what I was trying to do. I wasn't so wrong after all.
Thanks you, Dani, your code helps me a lot :D
2006/12/2, D. Bolliger <[EMAIL PROTECTED]>:
Sergio Escalada am Samstag, 2. Dezember 2006 15:41:
> Thanks for replies.
>
> The purpouse of this mini-script is to list the rows
Sergio Escalada am Samstag, 2. Dezember 2006 15:41:
> Thanks for replies.
>
> The purpouse of this mini-script is to list the rows from a database loaded
> in memory ($ref_db is the reference to hashtable that cotains the DB). So I
> want to order the fields by different sort rules, and make the pr
#
# hashref? Why in the WORLD is the database being kept in a hashref?
#
Oh, it's an exercise for class, and I must keep data in a hashtable, it's
not my fault ^_^
Thanks for your code :)
#
# if you have a small number of columns you want to sort by, build a
# simple subroutine to sort by
On 12/02/2006 06:22 AM, Sergio Escalada wrote:
Hi all! I would like to know if it's possible to make an array sorting with
a subroutine call.
Usually, a sort is made as, for example:
sort {$a <=> $b} @array;
But my intention is something like:
sort subroutine_call @array;
sub subroutine
{
> The purpouse of this mini-script is to list the rows from a database loaded
> in memory ($ref_db is the reference to hashtable that cotains the DB). So I
> want to order the fields by different sort rules, and make the proccess as
> abstract as it's possible with a subrutine (sub cmpRule). This s
On 12/2/06, Sergio Escalada <[EMAIL PROTECTED]> wrote:
The purpouse of this mini-script is to list the rows from a database loaded
in memory ($ref_db is the reference to hashtable
Another idea -
sub sortrows {
my $sorted = @_;
$sorted = -(($a->{ahash} eq 'x') <=> ($b->{ahash} eq 'x')) if $
Thanks for replies.
The purpouse of this mini-script is to list the rows from a database loaded
in memory ($ref_db is the reference to hashtable that cotains the DB). So I
want to order the fields by different sort rules, and make the proccess as
abstract as it's possible with a subrutine (sub cm
Sergio Escalada wrote:
Hi all! I would like to know if it's possible to make an array sorting with
a subroutine call.
Usually, a sort is made as, for example:
sort {$a <=> $b} @array;
But my intention is something like:
sort subroutine_call @array;
sub subroutine
{
$a <=> $b;
}
How cou
Sergio Escalada wrote:
Hi all! I would like to know if it's possible to make an array sorting with
a subroutine call.
Usually, a sort is made as, for example:
sort {$a <=> $b} @array;
But my intention is something like:
sort subroutine_call @array;
sub subroutine
{
$a <=> $b;
}
How cou
> Hi all! I would like to know if it's possible to make an array sorting with
> a subroutine call.
>
> Usually, a sort is made as, for example:
>
>
> sort {$a <=> $b} @array;
>
>
> But my intention is something like:
>
>
> sort subroutine_call @array;
>
> sub subroutine
> {
> $a <=> $b;
> }
Sergio Escalada wrote:
Hi all! I would like to know if it's possible to make an array sorting with
a subroutine call.
Usually, a sort is made as, for example:
sort {$a <=> $b} @array;
But my intention is something like:
sort subroutine_call @array;
If you really want to call it like this
John W. Burns am Donnerstag, 28. September 2006 17:11:
> Sorting DBM Hash
> Greetings:
Hello John W.
> I've run into what appears to be a conflict in sorting
> a DBM Hash. The DBM is opened and closed through tie and untie to store
> selections
> from Perl Tk medical questionnaire which uses che
Hardly Armchair wrote:
>
> Hello List,
>
> I have a data structure like so:
>
> %p_mod = {
> 'A' => {
> 'fingers' => {
> '4' => 'ABSFMQS',
> '5' => 'SMTFQNL',
>},
>
John W. Krahn wrote:
Hardly Armchair wrote:
Hello List,
Hello,
I have a data structure like so:
%p_mod = {
^
You are using the wrong punctuation. That would produce a warning if you had
warnings enabled.
Sorry. I'm actually generating this data structure dynamically and just
Hardly Armchair wrote:
> Hello List,
Hello,
> I have a data structure like so:
>
> %p_mod = {
^
You are using the wrong punctuation. That would produce a warning if you had
warnings enabled.
> 'A' => {
> 'fingers' => {
> '
1 - 100 of 364 matches
Mail list logo