Just wrestled with a very odd quirk. I have two programs doing virtually the exact same thing but in one, this line:
$id = ($id =~ /\d+/)
gives the answer you expect -- the first occurence of some digits.
In the second script, namely links jump.cgi, that particular expression evaluates to 'true' and $id = 1 each and every time.
Drove me crazy!
FWIW ... stick to the BtB syntax:
($id) = ($id =~ /(\d+)/)
And it works -- $id ends up as some digits rather than '1'
It was the _exact_ same segment of code (actually cut/pasted from one to the other), in the _exact_ same relationship, being run on the same web server, same version of perl, at the same time, but one was evaluated as expected, the other wasn't.
I post this since that's how you'd break up something like 245.html, and wonder if anyone else has hit anything like that --- a code statement that evaluates differently in different programs -- not different contexts.
Scott
$id = ($id =~ /\d+/)
gives the answer you expect -- the first occurence of some digits.
In the second script, namely links jump.cgi, that particular expression evaluates to 'true' and $id = 1 each and every time.
Drove me crazy!
FWIW ... stick to the BtB syntax:
($id) = ($id =~ /(\d+)/)
And it works -- $id ends up as some digits rather than '1'
It was the _exact_ same segment of code (actually cut/pasted from one to the other), in the _exact_ same relationship, being run on the same web server, same version of perl, at the same time, but one was evaluated as expected, the other wasn't.
I post this since that's how you'd break up something like 245.html, and wonder if anyone else has hit anything like that --- a code statement that evaluates differently in different programs -- not different contexts.
Scott

