I think you should investigate why the substr built-in
is named "substr" and not "substring", "subStr",
"subString", "sub_str", "sub_string" or any of
a large number of other possibilities.
Alas, even the shortest of these (substr)
is way too long to be
competitive at code golf.
As a golfer, I wish Perl had used a built-in operator rather than the substr function
for string slicing.
This is one of the very few areas where Python
trounces Perl at code golf, as discussed in detail
at Re: Drunk on golf: 99 Bottles of Beer.
Quite apart from golf, I miss Python's concise and
powerful string slicing operator when coding
in Perl and feel string slicing is a common enough
operation to warrant a very short "Huffman-coded"
way to do it --
especially given "things that are commonly used should be
shorter/more succinct" is one of Larry's
language design principles.
I also find it odd that Perl supports built-in
array and hash slices, but not built-in string slices.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|