I was I was babbling in #perl on irc.freenode.net about the perl design decision to not overload '.=' to work differently when operating on an array (pushing.) I feel this should work 'as I expect it to', and there is no reason to make this operator useless when the lhs is an array, or array ref. However, my opinions aside, Rindolf made a suggestion that should be the subject of meditation and might fit even more with the Perl ideology. ",=". It should be noted that such an operator wouldn't cause breakage with 5.10 because of its status in 5.8 -- nonexistent. It would be looked upon like //=, as sexy syntactic sugar.
Transcript as follows:
12:03 < EvanCarroll> eval: @_=[qw/foo bar baz/]; @_ .= 'bleh'; @_;
12:03 < buubot> EvanCarroll: Error: Can't modify array dereference in
+concatenation (.) or string at eval line 1, at EOF
12:03 < EvanCarroll> didn't think so
12:03 < EvanCarroll> oh well back to pushing
12:03 < rindolf> EvanCarroll: maybe there should be a ,=
12:04 < rindolf> EvanCarroll: you can also try to overload an operator
+.
12:04 < EvanCarroll> rindolf: wow, thats actually a good idea.
12:04 < EvanCarroll> rindolf: I won't overload it for myself; but ,= w
+ould fit very elegantly into the perl arsenal of operators
Evan Carroll www.EvanCarroll.com
-
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.
|