[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]
Adrian Midgley <amidgley2@xxxxxxxxxx> writes:
On Mon, 2005-03-21 at 20:51, Aaron Trevena wrote:Also the sigils clarify things a great deal. They take some getting used to but the reward is huge.sigils?
Yeah, perl uses symbols to denote certain things, which clears things up when you know what they mean, most usually as prefixes to variables. You may have seen php with variables like $foo and $bar = array(); these came from Perl, but php uses $ for everything. In Perl $ indicates that something is being used in a scalar context, ie $foo = "bar", or $foo[0] = "bar", or even $foo{baz} = "bar". while the sigils @ and % denote that the variable is an array or associative array, being used in list context. things get a bit more complex when you start using references (kind of sort of like pointers), and an awful lot of expressiveness is packed into punctuation, and there is also a load of implicit shortcuts that save you time at the expense of readability, such as the idiomatic foreach loop:- @foo = (1 .. 10); foreach (@foo) { print $_, "\n"; } -- James jamesk[at]homeric[dot]co[dot]uk Most soapbar comes from f--king Holland, it's made from oil and tyres and pollen - Goldie Lookin' Chain "Soapbar" -- The Mailing List for the Devon & Cornwall LUG Mail majordomo@xxxxxxxxxxxxx with "unsubscribe list" in the message body to unsubscribe. FAQ: www.dcglug.org.uk/linux_adm/list-faq.html