Hi,

I want to apply a certain substition to a string, whereas the whole
substitution is defined in a variable in another script. Unfortunately,
it doesn't work as wanted :-( Looks like this:

sub.conf:
$sub='s/db$//g';

script.pl:
do sub.conf;
print "Please enter string: ";  # e.g. mydb
$input=<STDIN>;
print "$sub\n";  # gives the exact string as defined in sub.conf
(without apostrophes)
$input=~$sub;
print "$input\n";  # in this example should be "my"

Can anybody please tell me my mistake?

Thanks in advance, 
Nora 



Reply via email to