R
Ricky
Hi gurus,
I m reading a regexp and a string from an external file (actually my
program configuration file).
After, I need to do a string matching, using previously loaded regex,
and print the "destination" result, using special variable $2,
hardcoded in my conf.
I have no luck..please give me some hints:
Here is my configuration line:
rule (^.*blabla-dir/blabla-file/)(.*$) /somedirectory/
somefile/$2 LABEL
perl code extract:
....
/(^rule)\s+(.[^\s]+)\s+([\/\w\$]+)\s+(\w+)/
$regex[$i]=$2;
$destination[$i]=$3;
...
...
$_="/blabla-dir/blabla-file/OIAC-ciao";
if ( /$regex[$i]/ ) {
print "$destination[$i]\n";
}
...
The print only show:
/somedir/somepath/$2
but I need to "explode" that $2. Note that if i modify the print as
follows:
print "$2 $destination[$i]\n";
it returns:
OIAC-ciao /somedir/somepath/$2
I'm sure there is a way to do this..but I am a noob programmer
Thanks,
perlnoob
I m reading a regexp and a string from an external file (actually my
program configuration file).
After, I need to do a string matching, using previously loaded regex,
and print the "destination" result, using special variable $2,
hardcoded in my conf.
I have no luck..please give me some hints:
Here is my configuration line:
rule (^.*blabla-dir/blabla-file/)(.*$) /somedirectory/
somefile/$2 LABEL
perl code extract:
....
/(^rule)\s+(.[^\s]+)\s+([\/\w\$]+)\s+(\w+)/
$regex[$i]=$2;
$destination[$i]=$3;
...
...
$_="/blabla-dir/blabla-file/OIAC-ciao";
if ( /$regex[$i]/ ) {
print "$destination[$i]\n";
}
...
The print only show:
/somedir/somepath/$2
but I need to "explode" that $2. Note that if i modify the print as
follows:
print "$2 $destination[$i]\n";
it returns:
OIAC-ciao /somedir/somepath/$2
I'm sure there is a way to do this..but I am a noob programmer
Thanks,
perlnoob