psss...I want to move from Perl to Python

Random832 random832 at fastmail.com
Fri Jan 29 10:07:57 EST 2016


On Fri, Jan 29, 2016, at 04:12, Ulli Horlacher wrote:
> Steven D'Aprano <steve at pearwood.info> wrote:
> 
> > Every time I make a half-hearted attempt to learn enough Perl syntax to get
> > started, I keep running into the differences between $foo, %foo and @foo
> > and dire warnings about what happens if you use the wrong sigil
...
> $foo is a scalar (number, string, reference, file handle)
> @foo is an array
> %foo is a hash (dictionary in Python slang)
> 
> and yes, you can use them all together in same code, they are different.

The main source of confusion is that $foo[5] is an element of @foo.
$foo{'x'} is an element of %foo. Both of these have absolutely nothing
to do with $foo.



More information about the Python-list mailing list