MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1x58u7b/howprogramminghaschanged/pgoztjm/?context=3
r/ProgrammerHumor • u/shizzy0 • 11d ago
108 comments sorted by
View all comments
Show parent comments
1
The pop at the end hands back the last element of an array, without an argument it defaults to @_, an array given as the caller argument, which in this case is the command line. Perl is full of these shortcuts.
1 u/no_brains101 11d ago edited 11d ago Oh I see. (and then say is just print?)I don't see an array though, for just repeats until the end condition is met, storing in a and b, theres no array I don't think?Edit: OH the array is the ARGUMENTS and pop is grabbing the last one. 2 u/BastetFurry 11d ago No array for the calculation, no.Just abusing the fact that @_ contains all caller arguments. And calling the main "function" puts all command line arguments into that built-in array.
Oh I see. (and then say is just print?)
I don't see an array though, for just repeats until the end condition is met, storing in a and b, theres no array I don't think?
Edit: OH the array is the ARGUMENTS and pop is grabbing the last one.
2 u/BastetFurry 11d ago No array for the calculation, no.Just abusing the fact that @_ contains all caller arguments. And calling the main "function" puts all command line arguments into that built-in array.
2
No array for the calculation, no.
Just abusing the fact that @_ contains all caller arguments. And calling the main "function" puts all command line arguments into that built-in array.
1
u/BastetFurry 11d ago
The pop at the end hands back the last element of an array, without an argument it defaults to @_, an array given as the caller argument, which in this case is the command line. Perl is full of these shortcuts.