When we pass a literal number, for example MODIFY(4), what do you call that?
I call it "argument", just as any non-literal argument. The difference is subtly hinted at in perlsub:
In a subroutine that does not use signatures, any arguments passed in show up in the array @_. Therefore, if you called a function with two arguments, those would be stored in $_[0] and $_[1]. The array @_ is a local array, but its elements are aliases for the actual scalar parameters. In particular, if an element $_[0] is updated, the corresponding argument is updated (or an error occurs if it is not updatable).
Maybe your original question stems from this, as "updatable" is more or less the same as "lvalue"?
| [reply] |
Maybe you found a bug in (Tiny)Perl 5.8.0.
It's a bit too late for a bugreport, I'm afraid.
Greetings, -jo
$gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$
| [reply] |
$ perl -E 'sub foo { $_[0]= 5 } foo(4)'
Modification of a read-only value attempted at -e line 1.
I would call '4' a "constant", though it appears perl calls it a "read-only value". You can find out whether one of your parameters is readonly like this:
use Scalar::Util "readonly";
sub foo {
printf "%s\n", readonly($_[0])? "readonly" : "writable";
$_[0]= 5 if !readonly($_[0])
}
foo(4);
foo(my $x= 4);
print "$x\n";
Maybe tinyperl's errors are different. If you had an error somewhere like "Can't use a constant as an LVALUE" I can see where that might have been confusing, but LVALUE is referring to "a thing which can be assigned-to", and that error would be saying basically that you can't use a read-only or constant on the left side of an equal sign. | [reply] [d/l] [select] |
Thirdly, I am using Windows XP again with TinyPerl 5.8 now
I have a feeling that I am going to regret asking...but I am rather intrigued...
Why are you using an OS that was retired over a decade ago and what are you using a Perl version from two decades ago?
Do you drive an Austin Allegro by any chance???
| [reply] |
No, I don't drive an Austin Allegro. Haha I drive a minivan. I use Windows XP, because it's small and fast and gets the job done. And it's just perfect for my needs. When I was about 12 years old, my parents bought me my first computer. It was a 386DX 40MHz with 128MB HDD and 4MB RAM. It had MS-DOS 5.00 on it. I had a friend named Simon Istvan who is a computer programmer who gave me lessons every week. And he taught me C/C++, assembly, HTML, and he also tried to introduce me to Linux and Perl, but at that time I did not have any interest in Perl. Linux is something I found very interesting, and I loved it. But it never really stuck with me. I was always a DOS/Windows primary user. Linux is something I used just for fun or in case of emergencies.
(Unlike most people, I think playing computer games is a total waste of time. There were only three games I liked -- chess, SimCity, and Sokoban. But I found none of them addictive. Like I could start and stop an hour later and never play again. In fact, I haven't played computer games in I don't know how many years. I just don't find it fulfilling or fun. I think, computer programming is a lot more fun, because you CREATE something real, something useful, something that makes the world a better place. So, I see computer programming as a way to improve the world. Games are just a waste of life.)
So, I have always been very interested in computer programming. When I was 17 years old, I began building computers and troubleshooting Windows problems, and people would call me almost every week to look at their computer. And I became known as a guru of some sort. And this went on for about a decade. In 2010, I created a computer business. Now I do data recovery, virus removal, Windows/Linux installation, website maintenance, and I refurbish old computers. But the amount of money that comes in through this business is so little that it's barely enough to buy chicken feed for my chickens! I have 24 chickens. LOL So, I do other things like construction... In 2000, I learned JavaScript by myself at home. Over the years, I came to love JavaScript. And in 2016, I began to learn Perl, and I realized how similar the two languages are. They are like brothers!
So, anyway, Windows XP stuck with me, because I have used it for so many years. I like the way it looks. I know how it works. There are certain things that it can do that I don't know how to do with other operating systems. I also know XP's limitations, so if I know it can't do a certain thing that I need, then I switch over to Linux or I have Windows 10 on another computer here, and I'll use that. So, I'm okay. But for most things, I use XP. Yesterday I opened a text file on my computer which I created over a decade ago. It's a file where I wrote down all the things I love to do and what makes me happy. One of the items on the list said, "I love using Windows XP." Interestingly, all the things listed in there are still true today! I still love to raise chickens. And I love to write programs. etc... I didn't change much at all. :)
| [reply] |
I have 24 chickens ... I still love to raise chickens
Do you enjoy Perl poetry?
If so, you might feel inspired by my @chickens to write a poem about your experiences raising chickens. :)
Chickens References Added Later 🐔 🐓 🐣
- Re: The 10**21 Problem (Part 2) - If you were plowing a field, which would you rather use? Two strong oxen or 1024 chickens?? ... I can tell you with authority, that if the 1024 chickens were fenced in, they would do a better job than 2 ox, at tearing up a field. They eat everything.
- The Chicken and the Pig (wikipedia) - When producing a dish made of eggs with ham or bacon, the pig provides the ham or bacon which requires his or her sacrifice and the chicken provides the eggs which are not difficult to produce. Thus the pig is really committed to that dish, while the chicken is only involved, yet both are needed to produce the dish. This fable was referenced to define two types of project members by the Scrum framework: pigs, who are totally committed to the project and accountable for its outcome, and chickens, who consult on the project and are informed of its progress.
- Nobody Expects the Agile Imposition (Part V): Meetings - From the "Dogmatic Pigs and Chickens" section: it's advised by Scrum that during the Daily Stand-up (or "Daily Scrum") only pigs are allowed to speak, chickens can listen in but can't speak ... unfortunately, what commonly happens in many instances is that the team sees themselves as the "pig" and all of management as their "chickens" ... the team "goes scrum" and all of a sudden Chicken/Pig cards are flying left and right ... the July 2011 Scrum Update removed all references to Pigs and Chickens; the labels were being used to create barriers between the Scrum team and individuals in the organization who potentially could assist the team.
| [reply] [d/l] |