[ic] [if ordered] in perl?

Jon Jensen jon at endpoint.com
Thu Jun 24 20:57:29 EDT 2004


On Thu, 24 Jun 2004, Thomas J.M. Burton wrote:

> So far, I know that I can access the cart with something like
> 
> 	my $cart = $Carts->{main};
> 
> being still a novice with perl, I'm not sure how to search that array 
> for the item code that I want to check for. I'm sure it's simple, but 
> could someone please help me out?

Off the top of my head, I think something like this will work:

for (@$cart) {
	next unless $_->{code} eq 'some_code';
	# do something with item in %$_
}

Jon


More information about the interchange-users mailing list