Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Well, I personaly feel lucky that the programming languages I use and my native language have very little in common.

    English is a foreign language, Perl is a foreign language, C is a foreign language, Befunge is an alien language (from outer space)... I never try to "speak" Perl as I speak English. And I never ever translate Perl to French (or the other way around).

    • I second BooK in that I don't try to write Perl code as I would write English. It's only a programming language and not a human language. But I admit I often choose the name of functions and variables so that one can read what they do and what they are. However I didn't even thought of reading the sigils that way. But it might be useful for teaching the difference between $array[1] and @array[1,2,3] to beginners.
      Close the world. txEn eht nepO
  • Hmm, Larry Wall is a linguist, this could explain the sigils.

    Of course, Perl6 reverses it to @foo[87].


    # I had a sig when sigs were cool
    use Sig;
  • if you also want to say something like:

    my $house = %house{87};

    when the data is stored in a hash?

    Here is why I ask...

    I also had the problem (at first) with the array slice. I thought initially that it was a sigil issue and an issue with semantics. (As you have explained)

    But, I noticed that I did not have the issue with a hash. It seemed to me that if the sigil was causing me to have a semantic problem that the problem would carry to other cases... but, in my case... it did not.

    So, I thought about it so

    • That's an interesting point: the immediate punishment of mistakes fixes habits quicker than things seeming to work. I certainly have seen the mistake made more often with arrays than hashes.

      The warnings pragma catches this misuse nowadays, but many beginners either don't know about it or don't use it.

      Unfortunately, I didn't learn hashes until I had already familiarised myself with arrays, so I can't answer your first question.
  • This is a comment from another French monger which doesn't have an account on user.Perl yet, and asked for someone to post it. So here it is.


    Well, I'm also a French native speaker and I must admit that I too made this mistake when I first learnt Perl, but I had to accept that "$" had to be used to access a single element and "@" to access the whole array. Actually, Perl's scalar and lists contexts still aren't really clear to me but the more I write Perl, the more I get used to it. I don't even try

    Close the world. txEn eht nepO
  • Many languages use some kind of mark (flexion?) on the word itself to denote the plural. Article like "les" in French are redundant as far as the plural or singular is concerned. It comes in definite form (les) and the indefinite one (des), but I don't think that distinction can translate usefully into Perl.

    I consider that the @ sigil is the equivalent in Perl of plural in natural languages, so I use the sigil in place of plural instead of with it.

    So I say @house and not @houses.

    I think that other p