[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ic] [if ordered] in perl?


Stefan Hornburg wrote:
On Fri, 25 Jun 2004 00:57:29 +0000 (UTC)
Jon Jensen <suppressed> wrote:


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 %$_
}


Or:

@some_codes = grep {$_->{code} eq 'some_code'} @$cart;

	Racke



Thanks to both of you! That really helped. :)

-Tom


--
________________________________________
Thomas J.M. Burton
Design & Production Director
Global Focus Digital Media, LLC
www.globalfocusdm.com
_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.