[Israel.pm] question about compiler

Mikhael Goikhman migo at homemail.com
Thu Nov 24 13:47:27 PST 2005


On 24 Nov 2005 15:32:59 +0200, Yuval Kogman wrote:
> 
> use if $condition 'Bar';

I am surprised to see such suggestion. It is full of syntax errors. :)

1) Can't have anything between "use" and a module name.
2) Can't use "if" in the "use" statement at all.
3) Can't use quoted 'Bar' in "use"; a module name bareword is required.


The answer to the original question is:

  BEGIN { eval "use Bar;" if $condition; }

Another possible solution (keep it at column 1):

  =pod
  use Bar;
  =cut

In earlier perls, you may need to add empty lines before the "=" lines.

Regards,
Mikhael.

-- 
perl -le 'print+chr(64+hex)for+split//,d9b815c07f9b8d1e'




More information about the Perl mailing list