Please help critcize and shorten my sub code
  Home FAQ Contact Sign in
 
Advanced search
POPULAR GROUPS

more...

found 8 articles for 0.196 sec
Re: Please help critcize and shorten my sub code     

Group: perl.beginners · Group Profile · Search for Please help critcize and shorten my sub code in perl.beginners
Author: Richard Lee
Date: May 10, 2008 20:03

.... And I made a mistake doing so, the code should have been like this: for my $... 'carrier_id', $carrierid, 'active'); return($trunkgroupid,$carriername,$carrier_active); } sub findValue { my ($dat, $section, $lookup_key, $lookup_value, $value_key) = ...to start to think more in terms of... re-using the code.. or rather finding ways to re-use the code. thank ...
Show full article (3.97Kb) · Show article thread
Re: Please help critcize and shorten my sub code     

Group: perl.beginners · Group Profile · Search for Please help critcize and shorten my sub code in perl.beginners
Author: Jenda Krynicky
Date: May 10, 2008 18:02

... replace them by a single one. And I made a mistake doing so, the code should have been like this: for my $wanted ( [outsideroute_group_m => route_name => ... = findValue( 'outsidecarrier_m', 'carrier_id', $carrierid, 'active'); return($trunkgroupid,$carriername,$carrier_active); } sub findValue { my ($dat, $section, $lookup_key, $lookup_value, $value_key) = @_; for ...
Show full article (3.57Kb) · Show article thread
Re: Please help critcize and shorten my sub code     

Group: perl.beginners · Group Profile · Search for Please help critcize and shorten my sub code in perl.beginners
Author: Richard Lee
Date: May 10, 2008 17:20

... to go through the array over and over again pending on my previous search so I ended up writing it like below which works.. but looks really really inefficient.. sub dd_fact { my $routename = shift; my $routegroupid; my $trunkgroupid; my $carriername; my $carrier_active; my $carrierid; You can declare ...
Show full article (2.78Kb) · Show article thread
Re: Please help critcize and shorten my sub code     

Group: perl.beginners · Group Profile · Search for Please help critcize and shorten my sub code in perl.beginners
Author: Jenda Krynicky
Date: May 10, 2008 17:05

... go through the array over and over again pending on my previous search so I ended up writing it like below which works.. but looks really really inefficient.. sub dd_fact { my $routename = shift; my $routegroupid; my $trunkgroupid; my $carriername; my $carrier_active; my $carrierid; You can declare several variables at once:...
Show full article (2.45Kb) · Show article thread
Please help critcize and shorten my sub code     

Group: perl.beginners · Group Profile · Search for Please help critcize and shorten my sub code in perl.beginners
Author: Richard Lee
Date: May 10, 2008 16:21

I dont know how to go through the array over and over again pending on my previous search so I ended up writing it like below which works.. but looks really really inefficient.. sub dd_fact { my $routename = shift; my $routegroupid; my $trunkgroupid; my $carriername; my $carrier_active; my $carrierid; AHI: for (@dat) { if (exists $_->{...
Show full article (1.53Kb)
Re: Please help critcize and shorten my sub code     

Group: perl.beginners · Group Profile · Search for Please help critcize and shorten my sub code in perl.beginners
Author: Rob Dixon
Date: May 11, 2008 12:57

Jenda Krynicky wrote: Only the loops that need to be labeled should be labeled. I agree. Apart from your spelling of 'labelled' :) Rob
Show full article (0.14Kb) · Show article thread
Re: Please help critcize and shorten my sub code     

Group: perl.beginners · Group Profile · Search for Please help critcize and shorten my sub code in perl.beginners
Author: Jenda Krynicky
Date: May 11, 2008 06:44

From: Peter Scott <Peter@PSDT.com> On Sun, 11 May 2008 02:05:06 +0200, Jenda Krynicky wrote: You do not need the label unless you need to jump out of some other loop than the innermost. In this case there are no nested loops so it would probably be better to skip the label. While I personally program the way you suggest, take note that "Perl Best Practices" says that...
Show full article (1.42Kb) · Show article thread
Re: Please help critcize and shorten my sub code     

Group: perl.beginners · Group Profile · Search for Please help critcize and shorten my sub code in perl.beginners
Author: Peter Scott
Date: May 11, 2008 05:56

On Sun, 11 May 2008 02:05:06 +0200, Jenda Krynicky wrote: You do not need the label unless you need to jump out of some other loop than the innermost. In this case there are no nested loops so it would probably be better to skip the label. While I personally program the way you suggest, take note that "Perl Best Practices" says that loops that are explicitly exited should be ...
Show full article (0.60Kb) · Show article thread