Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Perl Symbols

by davido (Archbishop)
on Aug 12, 2013 at 19:03 UTC ( #1049168=note: print w/replies, xml ) Need Help??

in reply to Perl Symbols

  1. $myroom->{$room}->{r}: $myroom contains a hash reference. The "->" operator dereferences it. $room must contain a hash key. {$room} uses the key in $room to index into the anonymous hash referenced by $myroom. $myroom->{$room} contains another anonymous hash reference. {r} indexes into that 2nd level anonymous hash.
  2. (/l: (.+)$/i): This part: /l: (.+)$/i is a regular expression. It says to match "l: ", followed by one or more characters, excluding newline. Capture those. And this all must occur at the end of the string. Case insensitively.
  3. Assign the value of 0 to the variable $system. Assign the first value captured in a regexp to $Proom. Assign the second value captured in a regexp to $cDept, after "upper casing" it.

Read the following: perlintro, perlretut, perlrequick, perlreftut, and uc.

Update: I see you have 21 posts here to PerlMonks starting in June. So perhaps my interpretation of your question was more basic than what you were asking. If so, I apologize and request that you be more specific in your question. And if not, then please read the documents I linked to. :)


Replies are listed 'Best First'.
Re^2: Perl Symbols
by Laurent_R (Canon) on Aug 12, 2013 at 21:01 UTC

    So perhaps my interpretation of your question was more basic than what you were asking.

    Looking that the OP's quite basic questions, probably not. ;-)

    Having said that, more specific details on the questions would certainly not harm.

Re^2: Perl Symbols
by johnrein55 (Novice) on Aug 13, 2013 at 17:59 UTC
    Thanks everyone for the help. I have one last query.
    push @{$myroom->{$room}->{dpt}},$exroom ; $myrooms->{$room}->{r} = $room ;

    I am trying to understand a script, so far it is good.


      At this point we should be able to ask you, "Well, what do you suppose those lines do?" And if you're unable to at least take a stab at it yourself, it means you didn't follow earlier advice to read the documentation.

      At the command prompt type "perldoc -f push". Or (easier on the eyes): visit and type in push.

      Now try "perldoc perlreftut", and then do the same for perldsc, perlref. Read them. Ask about the parts you don't understand.

      I'm not trying to be stubborn here, the questions in this thread are all indicators that you're trying to understand code without trying to understand the language the code is written in. We can tell you exactly what those lines are doing, but that would just be throwing good money after bad; someone's already written the documents, someone's already pointed you in their direction... I know that laziness is a virtue for Perl programmers (which is why the documentation was written in the first place), but asking others to read it and tell you what it says is false laziness -- it will be more work for you in the longrun if you have to ask each and every time.


        Thanks, I will follow your advice.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1049168]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2018-06-25 00:48 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.