Re: reducing perl cpu usage

2013-01-16 Thread budi pearl
Hi Jim, On Tue, Jan 15, 2013 at 12:51 AM, Jim Gibson wrote: > > On Jan 13, 2013, at 8:22 PM, budi pearl wrote: > > > Why do you want to reduce your CPU usage? > > That may seem like a silly question (who wouldn't want to reduce their CPU > usage), but the answer to

reducing perl cpu usage

2013-01-13 Thread budi pearl
Hi All, Is there any way to reduce the processor usage by perl? I am trying to use nice -19 but proc usage is still 100% Tasks: 189 total, 2 running, 187 sleeping, 0 stopped, 0 zombie Cpu(s): 0.0%us, 0.5%sy, 26.0%ni, 73.5%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 4042684k total, 34635

Re: Passing hash ref [ was Re: finding head and tail in data structure

2013-01-11 Thread budi pearl
Hi Jim, On Fri, Jan 11, 2013 at 1:54 PM, Jim Gibson wrote: > OR > > print_path( $id, $routes->{$id} ); > ... > sub print_path > { > ... > while( my ($start, $end) = each %$edges ) { > > This is what i want, thank you! Apparently passing "$routes->{$id}" is my earlier issue. --budi

Re: Passing hash ref [ was Re: finding head and tail in data structure

2013-01-10 Thread budi pearl
On Fri, Jan 11, 2013 at 11:05 AM, budi pearl wrote: > Hi Shawn, > > When trying to accessed inside subroutine , i got: > > Type of arg 1 to each must be hash (not hash element) at ./print_path.plline > 41, near "}) " > > Execution of ./print_path.pl aborted due

Re: Passing hash ref [ was Re: finding head and tail in data structure

2013-01-10 Thread budi pearl
}}) { but this not: while (my ($start, $end) = each %{$edges{$label}}) { Thanks. --budhi On Fri, Jan 11, 2013 at 10:47 AM, Shawn H Corey wrote: > On Fri, 11 Jan 2013 10:33:02 +0700 > budi pearl wrote: > > > my $id = "ROUTE-252"; > > print Dumper $routes{$id

Passing hash ref [ was Re: finding head and tail in data structure

2013-01-10 Thread budi pearl
Hi All, I would like to pass hash: %{$routes{"ROUTE-252"}} instead of %routes but got this error: [budi@dev bin]$ ./print_path.pl Type of arg 1 to each must be hash (not hash element) at ./print_path.plline 38, near "}) " Execution of ./print_path.pl aborted due to compilation errors. #use

Re: finding head and tail in data structure

2013-01-10 Thread budi pearl
Hi Rob, This works and looks much more simpler. Thanks, i love it. --budhi On Fri, Jan 11, 2013 at 1:00 AM, Rob Dixon wrote: > On 10/01/2013 10:01, budi perl wrote: > >> Hi, >> >> I have this following hash: >> >> #!/usr/bin/perl >> # >> use strict; >> use Data::Dumper; >> >> my %MYROUTES = (

Re: finding head and tail in data structure

2013-01-10 Thread budi pearl
On Thu, Jan 10, 2013 at 5:19 PM, David Precious wrote: > On Thu, 10 Jan 2013 17:01:43 +0700 > budi perl wrote: > You can't have the same hash key twice; you've duplicated 427 there. > > Also, you don't need to quote the left side of a fat comma, so you can > just as easily say e.g. ABEP => 441. >