Re^2: perldoc -lf anomaly
by Anonymous Monk on May 07, 2026 at 22:07 UTC
|
returns perlfunc and perlop regardless of what "whatever" is.
$ perldoc -lf anomaly
/home/choroba/localperl/lib/5.43.9/pod/perlfunc.pod
/home/choroba/localperl/lib/5.43.9/pod/perlop.pod
Thanks for looking into it choroba. These results clearly contradict the perldoc documentation:
perldoc perldoc (and man perldoc) says:
-l Display only the file name of the module found.
perldoc --help says:
-l Display the module's file name
Here's another anomaly:
% perldoc -lf splice
/Users/u/perl5/perlbrew/perls/perl-5.42.0/lib/5.42.0/pods/perlfunc.pod
/Users/u/perl5/perlbrew/perls/perl-5.42.0/lib/5.42.0/pods/perlop.pod
% perldoc $_
No documentation found for "splice".
% perldoc -v $_
'splice' does not look like a Perl variable
% perldoc -v '$_'
$_ The default input and pattern-searching space...
And another one:
% perldoc -v '$_'
$_ The default input and pattern-searching space...
% perldoc -v '@_'
@_ Within a subroutine the array @_ contains the parameters...
% perldoc -v '%_'
No documentation for perl variable '%_' found
| [reply] |
|
|
I'm not sure about the "another anomaly". You get the documentation of splice for $_, as $_ without quotes is the shell variable which contains the last argument of the last command.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
| [reply] [d/l] |
|
|
$_ without quotes is the shell variable which contains the last argument of the last command.
🤦
| [reply] |
|
|
> as $_ without quotes is the shell variable which contains the last argument of the last command
Similar to ALT-. which is introducing the last argument verbatim.
But what I was really longing for is a variable or hotkey producing the last output , alas this doesn't exist.
The closest I could find now is `!!` , I.e. to backtick the last command.
But I'd really love to facilitate this be defining a shortcut introducing `!!` ...
So I figured out bind '"\e,":"`!!`"' (ESC for ALT) which also works well on termux.
Put it into your bashrc and it'll help you to incrementally build one liners.
Dumb example:
$ bind '"\e,":"`!!`"'
$ ls *re.pl
tst_re.pl
$ echo `!!` # typed "echo ALT-,"
echo `ls *re.pl` # expanded history entry
tst_re.pl
$
Update
This will nest better when used repeatedly
$ bind '"\e,":"$(!!)"'
| [reply] [d/l] [select] |
|
|
These results clearly contradict the perldoc documentation:
That's not true. The docs don't say what happens if you use -l with -f func instead of a module.
Here's another anomaly
What do you think is anomalous? That it's looking up splice instead of $_? That's your error. You interpolated shell variable $_ into your shell command, and it apparently had the value splice.
And another one:
What do you think is anomalous? That output is correct too, and I have no idea what you think is wrong.
| [reply] [d/l] [select] |
|
|
Ok I was confused about -lf (and -lv and -lq) and my $_ anomaly is pure facepalm. But what about this:
% perldoc -v '%_'
No documentation for perl variable '%_' found
%_ is a special snowflake like $_ and @_ in that they can be used under strict without declaration and they all fail in the same way if you try to own them with my: Can't use global %_ in "my" (but our and local work on all of them). I like using it sometimes in one-liners and dirty scripts cause $_{$_} looks weird and cool and it works good and I like typing it! Anyway I made Claude Haiku 4.5 at duck.ai think about %_ for 36 seconds! I've never seen the robots get so confused. They insist it doesn't exist, or it's nothing special, or that it's a filehandle or a reference to the last call to stat lol:
perl -Mstrict -Mwarnings -le '%_ = ( foo => 1, bar => 2 ); print "$_ =
+ $_{$_}" for keys %_'
foo = 1
bar = 2
So why isn't it documented? I could swear I saw it somewhere once upon a time, or maybe not... What is it??? Thanks
| [reply] [d/l] |
|
|
|
|
|
|
|
|
|
These results clearly contradict the perldoc documentation:
That's not true. The docs don't say what happens if you use -l with -f func instead of a module.
Here's another anomaly
What do you think is anomalous? That it's looking up splice instead of $_? That's your error. You interpolated shell variable $_ into your shell command, and it apparently had the value splice.
And another one:
What do you think is anomalous? That output is correct too, and I have no idea what you think is wrong.
| [reply] [d/l] [select] |