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
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, $b) = @_;
$a =~ s/^(.*?),
David Schmidt wrote:
You might want to look into fork
http://perldoc.perl.org/functions/fork.html
http://www.tutorialspoint.com/perl/perl_fork.htm
thank you..
I was experimenting w/ forks but I definitely need to understand forking
better.
thanks!!
--
To unsubscribe, e-mail: beginners-
Another fun way is to use `reverse' and `numeric/string conversion' as
below.
perl -le 'print 0+reverse int 0+reverse "1.2.3.45"'
45
Best regards,
Todd
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
From: Panda-X
> I have a hash tree, which sub- and sub-sub-sub ( and whatever )
> items inside are all hashes.
>
> and the next step I dealing with this hash tree is to use
> Data::Dumper to dump it out.
>
> What I hope that the Data::Dumper result can keep the order as
> what I declared at very
From: Mark Tarver
> I have a very simple request.
>
> I want to know how many people click on a link. So what I want is a
> piece of Perl that writes this to a file. It can just be a tally mark
> like
> ! placed in the file.
>
> I cannot place anything on the target page because it does not be
From:
> I have several subroutines/functions in Perl script. I just wanted to
> know how to check whether specific function/subroutine in my Perl script
> is really executing or not. And if it is executing then what is the exit
> status of that function.
Have a look at http://search.cpan.org/~p
On Mon, Dec 15, 2008 at 04:18, Panda-X wrote:
> Hello,
>
> I have a hash tree, which sub- and sub-sub-sub ( and whatever )
> items inside are all hashes.
>
> and the next step I dealing with this hash tree is to use
> Data::Dumper to dump it out.
>
> What I hope that the Data::Dumper result can ke
You might want to look into fork
http://perldoc.perl.org/functions/fork.html
http://www.tutorialspoint.com/perl/perl_fork.htm
On Mon, Dec 15, 2008 at 3:40 PM, Richard wrote:
> John W. Krahn wrote:
>>
>> Richard wrote:
>>>
>>> John W. Krahn wrote:
You want something more like this:
John W. Krahn wrote:
Richard wrote:
John W. Krahn wrote:
You want something more like this:
sub counter {
my $count;
my $clear = `clear`;
my $counting = <<'EOF';
%s
| Counting...|
|
Hello,
I have a hash tree, which sub- and sub-sub-sub ( and whatever )
items inside are all hashes.
and the next step I dealing with this hash tree is to use
Data::Dumper to dump it out.
What I hope that the Data::Dumper result can keep the order as
what I declared at very first. Is that anyway
17 matches
Mail list logo