Apologies for not being perl enough in this post…
None necessary. It’s a weblog site for people involved with Perl, not a Perl article site. :-)
]]>Another related idea is to provide a way for a single .bashrc (and bashrc.d) to provide some custom settings amidst the same across every system. I like the idea of everything in a single directory, and maybe using (requiring?) a digit at the beginning of the snippet file name would provide the necessary utility.
Perhaps
0-*
host specific, if [ "$snip_name" == "0-$(hostname)" ]; then source
[1-9]-*
run if executable
otherwise
warn it's not being run
test -f "$x" || continue
As I see it you have a list of 'pass or escape loop' tests and finally you source the script if you get that far.
What would your suggested fix look like?
]]>Incorrect.
Replace sprintf
with scalar
and you will see that the result is exactly the same as you see here.
That’s because @_[0,1]
is a list expression, not an array, and list expressions in scalar context yield the last value from that list, for symmetry with the comma operator in scalar context (which does not create a list!).
Next, replace sprintf @_[0,1]
with sprintf @_
and you will see that that result is exactly what you said it should be.
That’s because @_
is an array expression, and those do yield their length in scalar context.
It's clearly taking in two parameters, but for some reason the second parameter is being coerced from a number to a string, formatted in the default manner (with only 15 digits (10 digits before the decimal and 5 after)), and then coerced back to a number which is then formatted and printed.
The only part of this that’s correct is that the second parameter is being stringified with the default stringification. Every other part of this theory is wrong.
What happens is that @_[0,1]
is evaluated to a list, then scalar context is applied, yielding the last value from that list, then this value is passed to sprintf
as the first parameter, for which sprintf
wants a string, so it gets stringified, and then sprintf
uses that as its format string. No other parameters are passed to sprintf
but the format string doesn’t demand any so that works out fine.
sub fmt { sprintf @_[0,1] }
# Your printf-style directives specify 1 argument, but no argument was supplied
sub fmt { sprintf $^a, $^b } # OK!
That it actually produces a list and then the last element of the list is produced is an implementation detail.
]]>```
constant vanEck's = 0, {@_.end - (@_.head(*-1).first(@_.tail):end:k//(@_.end))}...∞;
```
Otherwise, we will get undefined error on `$N`.
]]>Since the days PC computers got more than 640K of disk space on a floppy it has stopped to be an issue.
In the good old days of 64k many of old farts would argue for 'tabs' as the took only 8 bits of less memory than while '4 spaces' took up 32.
In the big scope of things it really doesn't matter much