OT: Reason to love the snake #332

Bruce Dykes bkd at graphnet.com
Wed Jan 30 00:59:38 EST 2002


Found on another board:

> Actual code found in a production application:
>
> foreach (@list) {
>         /=/;
>         eval( qq( \$$` = "$'" ));
> }
>
> Now, that's obscure and overlong. You could just do:
>
> s/([^=]*?)=(.*)/\$$1="$2"/e for (@list);
>
> (Of course, no sane person would, but somebody managed to whip out the
first
> one without any apparent discomfort, either).
>






More information about the Python-list mailing list