[ic] Quick (hopefully) shipping question

Jon Jensen jon at endpoint.com
Wed Mar 25 22:56:19 UTC 2009


On Wed, 25 Mar 2009, Peter wrote:

> I would recommend this instead, as it won't break if there is a } 
> character in your shipping description (will work with version 5.3.2 and 
> later):
>
> [loop-calc]
> 	$Row->{shipmode} =~ /\((.*)\)/;
> 	return $1;
> [/loop-calc]

It's not safe to use the $1 etc. capturing variables without verifying the 
match succeeded, as they will contain the value of the last match. (See 
perlre for details.) Better would be:

     $Row->{shipmode} =~ /\((.*)\)/ and return $1;
     return;

Jon

-- 
Jon Jensen
End Point Corporation
http://www.endpoint.com/



More information about the interchange-users mailing list