Editing 1306: Sigil Cycle

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 24: Line 24:
  
 
;{{w|Perl}}
 
;{{w|Perl}}
βˆ’
:In Perl, the initial character provides the context of the variable. Scalars (text, numeric and also to references to data) start with the $ character. An @ is for an array. With %, it is a hash (a loose non-sequential array, or 'dictionary' lookup). Functions ''can'' be given a preceding &, but rarely need this in straightforward use. You can use the variables $temp, @temp, %temp and &temp simultaneously and independently. There is also the * (not in a mathematical sense) which identifies a 'glob', a way to fuse or use all those types (and more!) in 'interesting' ways if you have a yen to.
+
:In Perl, variables of simple types, i.e, scalars, and references to items in arrays and hashes, start with $. Arrays start with @. Hashes start with %.
βˆ’
:A block, with {} surrounding some other suitable statement(s), can potentially be typed to (re)interpret the context within. If you have a $reference which currently points to an @array, @{$reference} will let you use it as a direct array. But in simple cases, like that, this can often be shortened to @$reference, as alluded to by the "@$PERL" of the comic. (Just as $$reference would be a valid way to dereference the $reference when it points to $scalar... or even to $anotherReference that itself points to a %hash, in which case you could even use %$$reference for 'direct' access to that. Perl can be complicated, if you let it!)
 
  
 
;{{w|Python (programming language)|Python}}
 
;{{w|Python (programming language)|Python}}

Please note that all contributions to explain xkcd may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see explain xkcd:Copyrights for details). Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel | Editing help (opens in new window)