[Omaha.pm] for loop quickie

Rob Townley rob.townley at gmail.com
Wed May 24 13:59:34 PDT 2006


On 5/22/06, Jay Hannah <jhannah at omnihotels.com> wrote:
>
> before:
>
>    for ($j = 0; $j < @row; $j++) {
>       $row[$j] =~ s/[^ -~]//g;
>       $row[$j] =~ s/\|/:/g;
>    }
>
> after:
>
>    for (@row) {
>       s/[^ -~]//g;
>       s/\|/:/g;
>    }
>
> j

     If i had a bug however, oftentimes i would have to take the
shorter version and make it longer temporarily.  Can't the re be
written in one line?


More information about the Omaha-pm mailing list