Well, no - in fact, everything won't still work.
ben@Tyr:/tmp$ echo -e 'sub greet { "Hello, world!\\n" }\n1;' > hello.p
+l
ben@Tyr:/tmp$ perl -Mhello.pl -we'print greet'
syntax error at -e line 0, near "use hello."
Execution of -e aborted due to compilation errors.
ben@Tyr:/tmp$ perl -Mhello -we'print greet'
Can't locate hello.pm in @INC (@INC contains: /etc/perl /usr/local/lib
+/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/per
+l5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl /us
+r/local/lib/perl/5.8.7 /usr/local/share/perl/5.8.7 .).
BEGIN failed--compilation aborted.
As toolic pointed out, you can't load a '.pl' file as a module; you'd have to use "require" (or "do") instead of "use". Which opens up a very large can of worms.
Libraries are loaded at run-time; modules are loaded at compile time. This, in itself, is a huge difference that allows modules much, much more scope for action than libraries. "use Xyz" also imports the symbols and the semantics from package "Xyz" into the current one - not something that happens with "require Xyz.pl" (which just checks to see if Xyz.pl has already been loaded, updates %INC, and "wraps" a lexical scope block around the content of "Xyz.pl".)
Last of all, libraries are pretty much deprecated. They're a Bad Idea - at least, they've come to be seen as one - for a number of reasons (namespace conflicts, among other reasons.) In general, the preferred thing is to "use" a module - and to create modules instead of libraries if you're building things.
For more info, please see 'perldoc perlmodlib'.
--
Human history becomes more and more a race between education and catastrophe. -- HG Wells
|