Could you explain me the following statements.
I personally believe that if the above is a question, then it should end with a question mark. If it is a question, then the answer is yes! If you want me to also explain you "the following statements" then I'll do so only in the order given by:
perl -MList::Util=shuffle -E "say shuffle 1..5"
You have to work out which is which, so some work is left to you, since this is not a helpdesk:
- This is part of code assigning a string to a lexical variable which is declared in the same statement. But the string is not closed, which is the reason why it's only a portion of code - i.e. as such it is not valid Perl. The string also seems to contain code which resembles but is not Perl - it misses the correct statement separator and sports an unknown operator.
- Assignment of a variable's value to another variable. The variables have the same name but (supposedly) live in different packages. The package the variable being assigned to lives in has a name which follows the convention Perl assigns to pragmatas, but which also sound dubious in that role...
- A variable is assigned the full path to the program and then stripped of everything that precedes the last slash in it, including the latter.
- A sub is called on a sub which is called on a literal string and on a variable. Both subs are called the "old" way, which is nowadays deprecated.
- This is not valid Perl, but it would be if you remove a spurious slash. If you remove it, then a variable is assigned either the first command line argument or the first argument passed to a sub (depending on whether the expression is inside a sub or not) if the special variable $_ begins with a given string. (Upon assignement, if it takes place, either the @ARGV or @_ array gets shifted) But then it strongly smells like another error, and if it is then a tilde is missing somewhere to the effect that the assignement takes place if a generic variable, instead of $_, begins with that given string.
-
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.
|