not easily, since they all do quite different things...
much easier as you have it, but if you are diong them often
maybe you should look into using qr{} to precompile the
regexps...
also, you realize that $print =~ s/([a,e,O])I/\1j/g; matches , as well as a e and O?
if you don't want to match comma use [aeO] [] is a character class, so it looks at characters, so a
separator is not necessary.
also I believe that using $1 in the second half of the substitution is preferred to \1... perl -w would tell you that...
you can do $print =~ s/([b-zA-Z]):/\1/g;
which should be much faster than $print =~ s/([b-z]|[A-Z]):/\1/g;
character classes can have as many ranges as you want in them.... but the (|)
will slow you down compared to a straight character class...
Update Oops... 9|3: does match 9 or 3:... my bad, ignore the next line
not sure, do you want 9|3: to match '9|3:' or do you want it to match '9' or '3:'... it will match the former...
- Ant
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.