Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I was enquiring as to what the orginal poster wanted to accomplish and why he thought he needed the typeglob syntax. That's a different question than how it works. You definately know how it works. We have a great intellectual question, but maybe we should be answering a different question? I'm just probing a bit to see if there is some more fundamental application issue here.

I looked at this inplace_uc code and I did add "$text =~" in front of the tr, which seemed appropriate.

Here, there is really no performance to be gained that I can see. The inplace_uc() call passes the whole string on the stack and there is some stuff to get the address of it. If we are doing an "inplace" replacement, why not just pass the addresss of the string instead of the whole string? My inplace_uc2() uses the address of the string in a very straightforward way.

As a perfence of style, I would always expect an inplace modification to to take place on an address or in Perl lingo a referece to something. Ok, mileage varies as they say.

#!/usr/bin/perl -w use strict; my $lc_msg = 'message'; inplace_uc ($lc_msg); print "$lc_msg\n"; sub inplace_uc { our $text; local *text = \$_[0]; # equivalent to: # local *text = \shift; $text =~ tr/a-z/A-Z/; # added $text =~ } my $lc_msg_y = 'another_message'; inplace_uc2 (\$lc_msg_y); print "$lc_msg_y\n"; sub inplace_uc2 { my $str_ref = shift; $$str_ref =~ tr/a-z/A-Z/; } # prints: #MESSAGE #ANOTHER_MESSAGE

In reply to Re^3: Tell me how it works! by Marshall
in thread Tell me how it works! by nagalenoj

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • 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, 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, 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (4)
    As of 2018-06-19 04:01 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (111 votes). Check out past polls.