Gossamer Forum
Home : General : Perl Programming :

Please help !

Quote Reply
Please help !
#!/usr/bin/perl

package setup;

$ENV{'PATH_TRANSLATED'} =~ s/\\/\//g;
$ENV{'PATH_TRANSLATED'} =~ s/\/(\w)+\.(\w)+$//;
$ENV{'SCRIPT_FILENAME'} =~ s/\/(\w)+\.(\w)+$//;
if (length($ENV{'SCRIPT_FILENAME'}) >1) { $path = $ENV{'SCRIPT_FILENAME'}; } else {$path=$ENV{'PATH_TRANSLATED'};}

use lib "$path";
use strict;

but that doesn't work

Pleae help



Mad
Quote Reply
Re: [appMaster] Please help ! In reply to
This was discussed a while ago....the "use" lines are evaluated before the rest of you code.

Use a BEGIN {} block for your regexs.

Or try a search for BEGIN and you should find the thread with a couple of solutions.