>>>>> "BF" == Brian Fraser <frase...@gmail.com> writes:
BF> On Fri, Apr 29, 2011 at 4:27 AM, Agnello George <agnello.dso...@gmail.com>wrote: >> Hi All >> >> is there a better way of writing this script >> >> BF> "Better" is fairly subjective - And with only a part of the program, there BF> isn't much that can be said. Is $status a global variable, or lexical? BF> On the other hand, if you mean more idiomatic way.. That's also subjective BF> :P But here's my stab at it: BF> my $status = join '', grep defined $jvalue{$_}, qw( 0 1 2 3 4 5 ); to pick a nit, the OP had $status .= also why use qw for sequential numbers when a range will do? so you can streamline yours with a slice: my $status = join '', grep defined, @jvalue{ 0 .. 5 } ; the only difference from mine is your is limited to the first 6 elements and my used the whole array. without more from the OP you can't tell which one is better suited. uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/