Scott R. Godin wrote: > Dave Adams wrote: >> Does perl allow you to conditionally include a module? >> >> For example: >> >> #!/usr/bin/perl -w >> use strict; >> my $DEBUG = 0; >> if (DEBUG) { >> use diagnostics; >> } >> my $filename = "test$$.txt"; >> open (FH , ">$filename") || die "error: $!"; >> print (FH "hi"); >> close (FH); >> >> Although this is a simple and silly example, it would be nice to be >> able to include the diagnostic module by setting my debug to true. > > If you're using Perl 5.7.3 or later you can > > use if $DEBUG, diagnostics -verbose; > > details in 'perldoc if' > > :) > > And all you people who answered with something other than this, aren't > you ashamed you didn't know about 'if' ? :)
Aren't you ashamed that you didn't read 'perldoc if' and see that the correct syntax is: use if $DEBUG, diagnostics => -verbose; ;-) John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>