Skip to content

Commit 9673377

Browse files
committed
Fix docs for $. replacements
Fixes #401
1 parent 3499fd9 commit 9673377

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

doc/Language/5to6-perlvar.pod6

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,17 @@ Currently no obvious equivalent.
416416
417417
=item $.
418418
419-
The current line number is returned by the C<.ins> method on the appropriate
420-
filehandle. E. g. C<$*IN.ins>.
419+
No direct replacement exists. For L<IO::Path> types L<IO::Handle> types,
420+
use L<kv> method on the L<Seq> returned from L<lines> to return indexes as well
421+
as lines. The numbering will start from zero, but it'll be there.
422+
423+
For L<IO::CatHandle> types
424+
(of which L«C<$*ARGFILES>|/language/variables#index-entry-%24%2AARGFILES» is
425+
one), you can use L«C<on-switch>|/type/IO::CatHandle#method_on-switch» hook
426+
to reset line number on handle switch, and increment it manually.
427+
See also L«C<IO::CatHandle::AutoLines>|https://modules.perl6.org/repo/IO::CatHandle::AutoLines»
428+
and L«C<LN>|https://modules.perl6.org/repo/LN» modules that simplify this
429+
operation.
421430
422431
=item $INPUT_RECORD_SEPARATOR
423432

0 commit comments

Comments
 (0)