Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

TeeJay (2309)

  (email not shown publicly)

Working in Truro
Graduate with BSc (Hons) in Computer Systems and Networks
pm :,,
lug : Devon & Cornwall LUG
irc : TeeJay
skype : hashbangperl
livejournal : hashbangperl []
flickr :hashbangperl []

Journal of TeeJay (2309)

Tuesday October 08, 2002
05:46 AM

another reason why perlscript is better than vbscript

[ #8240 ]

look at this piece of code in vbscript (remember that vbscript is apparently a non-typing language) :
intValue1 = request.form("value1") ' 88
intValue2 = request.form("value2") ' 133 ..

hundreds of lines of html mixed with vbscript ..

if intValue1 intValue2 then
end if

you would expect to get 'right' as 88 is less than 133 but vbscript being a Pile of Crud treats the values as strings so that 88 is somehow more than 133 - wtf?!?!

in perl I wouldn't have to worry about numerical operations on values because perl has scalars that work. vbscript however means you have to be sure that you have cast a variable to int before doing any numerical operations on it to avoid unpredictable and nasty behaviour.

EDITED :: I think the reason this happens is because sometimes rather than fetched directly from the form values the values are pulled from an array created by splitting a string. Nonetheless they should be treated as numbers when numerical operations are done on them - and to make matters worse now when I add cint to all the lines where the form.request values are fetched I get a type mismatch - in a typeless language ffs!!


The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Nonetheless they should be treated as numbers when numerical operations are done on them...

    But the point is that < (I assume that's the missing operator in your example) isn't a numerical operator, right? VBScript doesn't have separate < and lt operators, so (like PHP) it has to use the type of the operands to figure out what sort of comparison to do, and URL parameters are always going to start as strings. What else could it do?

    Or am I missing something? I've only written VBScript once.