Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's just a completely different model. Scalar context vs list context. @x returning length vs $x[0] accessing the list. It has a logic but it's its own logic.

Not unlike Rust's borrow checker but at least with Rust you know what you're being promised.





> It has a logic but it's its own logic.

Which is covered in the very first section of the course book? Yes it has its own logic. So do lots of programming languages.

How far do we need to take "not reading the doc"? That the very first chapter is too far? People who gave up on perl because of that... really would not have survived the rest of the course anyway?


You can learn Python, PHP and (a bit less) Ruby without ever touching a book, and definitely you can skip over the first chapter if you're an experienced programmer.

There must be a reason why they made sigils more "traditional" in Perl 6, for example.

> People who gave up on perl because of that... really would not have survived the rest of the course anyway?

I didn't give up on it, I just didn't feel the need to stick with it. I switched to something else that required less of a context switch when going back, awk or jq or Python.

Now, jq is something that throws me off every time I use it. But it's a completely different processing model, whereas lists and hashes are not specific to Perl.


> I just didn't feel the need to stick with it.

So, to touch on that, no contest that for a while now, you can have a well paying job only writing python. (And perhaps even never going through a formal course on it.) That has worked for many people.

> There must be a reason why they made sigils more "traditional" in Perl 6, for example.

Eh. Sigils are even more present / visible in perl 6. And other compact notation devices. All the way to making up your own unicode-based line noise when it serves. Which it does.


Yes, I didn't say that sigils went away. But for example in Perl 6 lists are @ whether you declare or access them, instead of the sigil changing depending on what you want to get out of the expressions. It says it in one of the first apocalypses even that people "found it a bit weird": https://metacpan.org/release/AUTRIJUS/Perl6-Bible-0.30/view/...

And at least with Rust, even if you don't love it, you can appreciate that there's a compelling reason for it to be that way. I wrote a lot of Perl, but never reached the aha moment where I understand why its sigils were so deliberately odd.

They were inherited from even older languages and meant pretty much the same thing there.

https://en.wikipedia.org/wiki/AWK#Match_pattern_from_command...

    #!/bin/sh
    
    pattern="$1"
    shift
    awk '/'"$pattern"'/ { print FILENAME ":" $0 }' "$@"
The $ notation for a variable in bash and awk... and BASIC...

    RIGHTS imm & def
    RIGHT$ (sexpr, aexpr)
    ...
    PRINT RIGHT$ ("APPLESOFT" + "WARE", 8)
    SOFIWARE
One might make the claim that EWD498 was correct... https://www.cs.utexas.edu/~EWD/transcriptions/EWD04xx/EWD498...

> It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.

https://www.perl.com/pub/2007/12/06/soto-11.html/

> Now, however it was initially intended, I think BASIC turned out to be one of the first major scripting languages, especially the extended version that DEC put onto its minicomputers called BASIC/PLUS, which happily included recursive functions with arguments. I started out as a BASIC programmer. Some people would say that I’m permanently damaged. Some people are undoubtedly right.

... but it wasn't without previous examples that Perl went the way that it did with sigils.


I'm familiar with those sigils from various places. Me on my childhood C64: "What does 'B dollar sign' mean?". It just boggles my mind that someone writing a brand new programming language would use them when there were English-like alternatives (like `my foo = keys barHash`). It was sometimes hard to remember what [sigil][name] was going to if you didn't already remember what [name]'s, erm, inherent type?, was. Like is $foo going to give me the string that was already in $foo, or perhaps the number of (occupied buckets)/(total buckets) if $foo is really a hash?

I was able to reason my way through these things and had luck writing reasonably large Perl programs. It did absolutely zero to help make devs' lives easier, though.


In 1987, when your audience of bash and awk and sed users was looking for a language to bring those together and were familiar with them... why wouldn't you use them?

I would also contend that given the tools at the time (vt100 terminals without syntax highlighting being prevalent systems) sigils made it easier to write more on a line, provided easier visual recognition (for those familiar with the language) about the syntax, and provided for a more easily written lexer.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: