use VBVar; use strict; # We have b_split return a VBVar object my $x = b_split('john,biran,someone',','); # Use value_of(), with optional arguments, to return # the value of the variable $response->write( $x->value_of(0), $x->value_of(2)); sub b_split { # not fully finished, needs $count and $compare my ($string, $delimiter, $count, $compare) = @_; $delimiter = quotemeta($delimiter); # Passes an array ref to the VBVar constructor, # which then creates the underlying object of the right # kind return VBVar->new([ split(/$delimiter/, $string) ]); }