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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.