If it's just combining two setters into one call, ...
How on earth did you reach that conclusion?
This syntax is standard perl and works now. Is my use of [] so confusing?
You've never used
substr( $buffer, $n, $m ) =~ s[this][that]g;
?
Note, this might be direct access to an internal buffer, but it could equally be a subset of a bigger than memory file, or a BLOB queried from a DB.
The problem is that, you cannot do anything afterwards.
So, for example, in the latter case, you could not arrange for the modified BLOB to be written back to the DB.
Of course, the alternative syntax is:
my $temp = $obj->get_thing( 15000, 20000 );
$temp =~ s[this][that]g;
$obj->set_thing( 15000, 200000, $temp );
which besides the:
- inconvenient notation;
- requirement for a temporary variable;
- the inefficiency of copying large chunks of data around unnecessarially.
- The need for two nearly identical pieces of code.
- and the potential for someone to come along and stick some other lines of code between two halves of what should be an "atomic" operation.
Did you notice the typo?
Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.
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.