Note: Ahbeyra was under the impression that one had to put print inside the code tags. Thus, this question and the next should be considered to be s/print "(.*)\\n"/$1/
Hrm -- an interesting bit of code, there. Taking it apart:
- $main::cmdbase_mult is a fully qualified variable name -- that is, it's saying "there's this scalar in package main whose name is cmdbase_mult."
- $main::cmdbase_mult->{'ignore'} takes that scalar, uses it as a hash reference, and looks up a key in said hash.
- = sub {...} creates an anonymous subroutine. That is, it'll return a (scalar, or course) reference to a subroutine that can be used later on down the line to call the subroutine that we put together now.
- $_[0]->uid_ignore($_[1]) is the body of the subroutine that we're making. It takes the first argument ($_[0]), treats it as an object, and calls the uid_ignore method on it with the second argument that was passed to it.
There are quite a few different things going on here. If you're curious about references, this piece by Dominus or perlref might help; "Coping with Scoping" or perlmod educates about the $main::cmdbase_mult bit, while perltoot might be useful for learning about objects.
Update: Added links to Dominus's pages, which are a bit more digestable than the plain ole' docs.
perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^+*`^ ve^#$&V"+@( NO CARRIER'
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.