[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;


Jon Jensen
End Point Corporation

More information about the interchange-users mailing list