[ic] Quick (hopefully) shipping question

Peter peter at pajamian.dhs.org
Wed Mar 25 23:23:11 UTC 2009


On 03/25/2009 03:56 PM, Jon Jensen wrote:
> 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;

Right,  good catch.


Peter




More information about the interchange-users mailing list