[EMAIL PROTECTED] wrote on 03/10/2006 11:21:47 AM:
>
> One thing I saw... You can replace all that if...elsif...elsif...
> elsif... stuff with an imitation switch. Like this:
>
> for ($Examine[0]) {
> /Uptime:\s+(\w.*)/i && do { $ws->Cells($row, "E")
> ->{'Value'} = "$1"; last; };
> /Kernel version:\s+(\w.*)/i && do { $ws->Cells($row, "F")
> ->{'Value'} = "$1"; last; };
> /Product type:\s+(\w.*)/i && do { $ws->Cells($row, "G")
> ->{'Value'} = "$1"; last; };
> # usw.
> }
>
> Lots cleaner, and, if I'm not mistaken, faster. I built a whole
> translation sub using nothing more than this trick. One hint for
> speed--if there are possibilities that get "hit" more frequently
> than others, although that doesn't seem the case here, put them at the
top.
>
> Deane
THNX!!! havent seen the imitation switch before. i know in c and php that
the switch is written so that the code driving it is more efficient.
i will definitely use this.
Josh
-----------------------------------------
PLEASE NOTE:
SeaChange International headquarters in Maynard, MA is moving!
Effective March 1, 2006, our new headquarters address will be:
SeaChange International
50 Nagog Park
Acton, MA 01720 USA
All telephone numbers remain the same:
Main Corporate Telephone: 978-897-0100
Customer Service Telephone: 978-897-7300
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs