[VPM] Oh...
Peter Scott
Peter at PSDT.com
Wed Aug 18 13:38:41 CDT 2004
At 11:11 PM 8/17/2004, abez wrote:
>brian d foy gave this example in the Perl Review v.1.0
>
>instead of
>
>my $pie = "";
>if (..) { $pie = 1; }
>elsif (..) { $pie = 2; }
>elsif (..) { $pie = 4; }
>elsif (..) { $pie = 8; }
>
>You could do...
>
>my $pie = do {
> if (..) { 1 }
> elsif (..) { 2 }
> elsif (..) { 4 }
> elsif (..) { 8 }
>}
>
>saves typing..
Damian Conway in his "Perl Best Practices" presentation recommends:
$pie = .. ? 1
: .. ? 2
: .. ? 4
: 8;
Change indentation to suit.
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com/
*** New! *** http://www.perlmedic.com/
More information about the Victoria-pm
mailing list