![]() |
|
good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^6: @INC from $0by afoken (Chancellor) |
on Jul 24, 2015 at 08:15 UTC ( #1136133=note: print w/replies, xml ) | Need Help?? |
use implies BEGIN, so that BEGIN should not be needed. There is a simpler way: use lib do { ... }, shown in Re^2: Calculations before using lib;. Combined with the s///r syntax from newer perls, this can be collapsed to use lib do { $0=~s[[\\/][^\\/]+$][]r };. Also note that $0 may not always contain an absolute path:
Alexander
-- Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
In Section
Seekers of Perl Wisdom
|
|