in reply to SQL and Perl comparison
One of the problem is your use of % in Perl. In your SQL example, % is a wild card, but not in Perl though. The Perl version does not seem to be correct. Get rid of that % in the regexp.
SQL does a head-to-tail match (it matches the entire string) and that is why you need that % at the end. But Perl regexp does not work in that way, it can match a portion of the string.
For example, SQL 'like abc%' is close to Perl's '/^abc.*$/. But in your case, if DDD always appears at the beginning, there is no need to use ^ or $.
Your second regexp could be as simple as /DDD_t/, or /^DDD_t/.
For your last two regexp's, you can use substr() just like the SQL version does.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: SQL and Perl comparison
by dragonchild (Archbishop) on Oct 27, 2005 at 12:11 UTC | |
|
Re^2: SQL and Perl comparison
by Win (Novice) on Oct 28, 2005 at 09:20 UTC |