in reply to Re: terrible code about array matching...
in thread terrible code about array matching...
That's a bit dangerous isn't it?
#!/usr/bin/perl use strict; use warnings; my @car = ('a', 'b,c'); my @cond = ('a', 'b', 'c'); if(join(',', @car) eq join(',', @cond)) { print "FOUND\n"; } else { print "NOT FOUND\n"; }
This indicates that the arrays are the same even tho', clearly, they aren't.
If you're going to use code like this you have to know what are valid characters in your input arrays and be very careful in choosing your join string.
--"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: terrible code about array matching...
by grantm (Parson) on Nov 06, 2002 at 20:52 UTC |