Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
this POD is either confusing or plain wrong

https://perldoc.perl.org/perlref#Declaring-a-Reference-to-a-Variable

    Beginning in v5.26.0, the referencing operator can come after my, state, our, or local. This syntax must be enabled with use feature 'declared_refs' . It is experimental, and will warn by default unless no warnings experimental::refaliasing is in effect.

In reality is the warning disabled with no warnings 'experimental::declared_refs';

the experimental::refaliasing warning belongs to https://perldoc.perl.org/perlref#Assigning-to-References

Sample code:

use strict; use warnings; use Data::Dump qw/pp dd/; use feature qw( declared_refs refaliasing say ); no warnings 'experimental::refaliasing'; my $a = [666]; my @a; \@a = $a; say $a[0]; no warnings 'experimental::declared_refs'; my \@arr = [42];

C:/Strawberry/perl/bin\perl.exe -w d:/tmp/pm/auto_ref.pl 666 Compilation finished at Sat Oct 16 14:45:33

NB: that use feature qw(declared_refs) doesn't seem to make sense without the other feature.

my \@arr; without assignment will create a new warning "Useless use of single ref constructor in void context"

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery


In reply to POD for use feature 'declared_refs' wrong by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-24 21:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found