The parser sees the option explicit, and realises that that means use strict. It sees the dim x(), and realises that that means my(@x). It understands that x is an array, and the parser always treats a solitry x as @x. And it goes forth, so the translation comes out roughly as;option explicit dim x() x = split("john,biran,someone",",") response.write(x(0) & x(2))
The @x[0] isn't clean, but it will do for now. This code works fine, and all is well. Well; all is well when we have wonderous option explicit. Unfortunately, there are many naughty VBScript developers who don't use option explicit. They don't define their variables. And my module gets very confused.use strict; my (@x); @x = b_split('john,biran,someone',','); $response->write(@x[0] . @x[2]); sub b_split { # not fully finished, needs $count and $compare my ($string, $delimiter, $count, $compare) = @_; $delimiter = quotemeta($delimiter); return split(/$delimiter/, $string); }
Which is all kinds of wrong. So, I started my quest for the solution.$x = b_split('john,biran,someone',','); print($x[0]; . $x[2]); sub b_split { # not fully finished, needs $count and $compare my ($string, $delimiter, $count, $compare) = @_; $delimiter = quotemeta($delimiter); return split(/$delimiter/, $string); }
In reply to A Tricky Problem with Context by tlhf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |