I have a Perl script that I want to analyse for CPU usage closer.
Can anyone tell me the best switches to use with tmon.out ?
I basically want to see what of my own written subroutines, and built in Perl
modules that may consume too much CPY cycles.
A few other queries on that subject:
Q1. If
They are the default variables used by sort for their processing.
That is why you want to be careful if you are using the variables $a and $b and
playing with sort besides.
Wags ;) ps to get a descending sort then switch where a and b are
used and it now becomes a descending sort verses a
this solution perfectly work to me:
foreach ( sort { $urls{$a} <=> $urls{$b} } keys %urls )
{ print LOG "$urls{$_} $_\n";}
thank' to all;
but I'm a beginner in perl programing world and i'd like to know how the $a
and $b vars work in this case.
thank's again!
Márcio Oliveira
LPIC-1
[EMAIL PROTECTED] wrote:
> hi!
>
> I need to organize a list of values i a hash, but i don't know how.
>
> ex:
>
> my %urls;
>
> $urls{uol} = 1;
> $urls{aol} = 2;
> $urls{txt} = 3;
>
> ## if i use this:
>
> @num = sort keys(%url};
>
> foreach $number(@num) {
>print $number."\n";
> }
try
Hello Márcio,
Thursday, July 29, 2004, 6:46:55 PM, you wrote:
MO> hi!
MO> I need to organize a list of values i a hash, but i don't know how.
MO> ex:
MO> my %urls;
MO> $urls{uol} = 1;
MO> $urls{aol} = 2;
MO> $urls{txt} = 3;
MO> ## if i use this:
MO> @num = sort keys(%url};
MO> foreach $num
One way is to make a custom sorting function. You pass it a list of items
and it goes through the list and compares each via the variables $a and $b.
You make the function return -1 if $a is "smaller than" or "before" $b, 1 if
$a is "bigger than" or "after" $b, or 0 if they are tied. In this case
You can sort the hash on the values with a snippet like this:
foreach ( sort { $urls{$a} cmp $urls{$b} } keys %urls ) {
print "$urls{$_} $_\n";
}
For more info, read perldoc -f sort.
--Kester
On Thu, 29 Jul 2004 13:46:55 -0300, Márcio Oliveira
<[EMAIL PROTECTED]> wrote:
> hi!
>
> I need t
hi!
I need to organize a list of values i a hash, but i don't know how.
ex:
my %urls;
$urls{uol} = 1;
$urls{aol} = 2;
$urls{txt} = 3;
## if i use this:
@num = sort keys(%url};
foreach $number(@num) {
print $number."\n";
}
## I have this output:
aol
txt
uol
## how i can organize the val
You know, I did look through the FAQ,
but did a find on "password" and not "encryption".
Thank you
-Original Message-
From: Sisyphus [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 29, 2004 8:18 AM
To: Ignacz, Alex
Cc: [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: Any way to proce
Hi there, my client has a set of files they want zipped up and then
password encoded or decoded (if I'm extracting from the archive). With
the password being able to be processed by a commercial zip utility like
WinZip.
Has anyone tackled this problem using Archive::Zip before?
I don't want to sh
10 matches
Mail list logo