chanakya has asked for the wisdom of the Perl Monks concerning the following question:
I get the following error when the script is executed#!/usr/bin/perl use strict; use warnings; use File::Basename; BEGIN { my $path = '/path/ABC/*.pm'; my @files = < $path >; foreach my $mod(@files){ my($filename, $directories, $suffix) = fileparse($mod); $filename=~s/\.pm//gx; use $filename; } }
Please let me know the correct way of loading the modules.syntax error at t.pl line 13, near "use $filename" BEGIN not safe after errors--compilation aborted at
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dynamically load all modules from a directory
by toolic (Bishop) on Oct 01, 2009 at 13:36 UTC | |
by chanakya (Friar) on Oct 02, 2009 at 10:33 UTC | |
by Anonymous Monk on Nov 19, 2014 at 04:34 UTC | |
|
Re: Dynamically load all modules from a directory
by Fletch (Bishop) on Oct 01, 2009 at 14:34 UTC | |
|
Re: Dynamically load all modules from a directory
by ELISHEVA (Prior) on Oct 01, 2009 at 15:27 UTC | |
|
Re: Dynamically load all modules from a directory
by jakobi (Pilgrim) on Oct 01, 2009 at 13:38 UTC |