tel2 has asked for the wisdom of the Perl Monks concerning the following question:
I'm using Perl 5.10.1 on Linux and if I run this code:
it fails with this error: "Undefined subroutine &main::encode_base64 called at ./test.pl line 4."#!/usr/bin/perl #...miscellaneous code here... require MIME::Base64; $x = encode_base64('abc');
Changing the "require" to "use" avoids the error.
Why do I get the above error when I "require", but not when I "use"?
(I was wanting to use "require" because this part of the code is rarely executed, so I thought this would be (slightly) more efficient.)
Thanks.
Tel2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: "require MIME::Base64" vs "use..."
by stevieb (Canon) on Jul 07, 2015 at 02:45 UTC | |
by tel2 (Pilgrim) on Jul 07, 2015 at 03:18 UTC | |
by 1nickt (Canon) on Jul 07, 2015 at 03:33 UTC | |
by tel2 (Pilgrim) on Jul 07, 2015 at 08:56 UTC | |
|
Re: "require MIME::Base64" vs "use..."
by Anonymous Monk on Jul 07, 2015 at 02:43 UTC | |
by tel2 (Pilgrim) on Jul 07, 2015 at 03:15 UTC |