Powerful perl paradigm I don't find in python
me
self at example.org
Fri Jan 15 10:20:33 EST 2016
On 2016-01-15, Ulli Horlacher <framstag at rus.uni-stuttgart.de> wrote:
> Charles T. Smith <cts.private.yahoo at gmail.com> wrote:
>> while ($str != $tail) {
>> $str ~= s/^(head-pattern)//;
>> use ($1);
>> }
>
> use() is illegal syntax in Perl.
Actually it is not. OP is defnitely thinking of `use` as a placeholder for
some general use of the value $1.
In fact, according to the documentation of perl,
use Module LIST
is equivalent of
BEGIN{ require Module; Module->import(LIST); }
For the rusty perl users, the code in `BEGIN` blocks are executed "as soon
as possible", that is before the remaining part of the code, and in order
of definition.
The idea is that you want to import all modules before running the code.
More information about the Python-list
mailing list