[Omaha.pm] Quick shorter code tip: for() {}
Ted Kat.
dark_house_666 at yahoo.com
Sat May 29 16:12:53 CDT 2004
nice!
but which has less overhead?
--- Jay Hannah <jay at jays.net> wrote:
>
> This came up at work this week...
>
> j
>
>
> BEFORE:
>
> while (($item_code,$enabled,$descript) = $sth->fetchrow_array)
> {
> $item_code =~ s/[^ -~]//g;
> $item_code =~ s/\s+$//;
> $enabled =~ s/[^ -~]//g;
> $enabled =~ s/\s+$//;
> $descript =~ s/[^ -~]//g;
> $descript =~ s/\s+$//;
>
> AFTER
>
> my @row;
> while (@row = $sth->fetchrow_array)
> {
> for (@row) {
> s/[^ -~]//g;
> s/\s+$//;
> }
> ($item_code,$enabled,$descript) = @row;
>
> _______________________________________________
> Omaha-pm mailing list
> Omaha-pm at pm.org
> http://www.pm.org/mailman/listinfo/omaha-pm
=====
Ted Katseres
----------------
------------------------
--------------------------------
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/
More information about the Omaha-pm
mailing list