>>>>> "VB" == Vicki Brown <[EMAIL PROTECTED]> writes:

  >> my $p_item = ( ... ) ? (split( /\n/, $item ))[0] : $item ;
  >> printf ORDER ("\n%4d   %-50s   %3.2f     %3.2f\n",
  >> $quantity, $p_item, $price, $ext);

  VB> You realize, don't you, that I didn't post the whole script...?

probably, but still, there is redundancy to be removed there.

  VB> There is also a loop that prints the rest of @item array...

then the slice can be changed to use a temp var.

  VB> Also (especially since I am writing this for a client whose Perl
  VB> knowledge is very slight) it's arguable whether this is all
  VB> "better".  Cute - yes, heavily idiomatic - natch, obfuscated -
  VB> surely, but better... eh.

my point was the removal of the duplicate printf's, if/else and their
braces, not the use of the slice. even if you need the braces to loop
over the item list, you can still use one printf call. that is doing
your client a favor by simplifying the code down to his level. :)

and you should never write code for the client, you write code for the
maintainer (who may be you, the client, or anyone else!). but this is
getting off fun (even if vicki is involved :)

uri

-- 
Uri Guttman  ------  [EMAIL PROTECTED]  -------- http://www.stemsystems.com
-- Stem is an Open Source Network Development Toolkit and Application Suite -
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org

Reply via email to