Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Meanigs of Expressions

by blazar (Canon)
on Oct 19, 2008 at 12:13 UTC ( [id://718048]=note: print w/replies, xml ) Need Help??


in reply to Meanigs of Expressions

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:

  1. 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.
  2. 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...
  3. 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.
  4. 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.
  5. 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.
--
If you can't understand the incipit, then please check the IPB Campaign.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://718048]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-04-24 01:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found