Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I think you are confusing yourself with arbitrary distinctions of exactly the kind that Perl cheerfully tramples over.

By your reasoning I would predict that local should not work on a hash value - because local replaces a scalar with another scalar temporarily. But lo and behold, look at this!

use Data::Dumper; %foo = qw(hello world); print Dumper \%foo; { local $foo{test} = "Just for now"; print Dumper \%foo; } print Dumper \%foo;
What happened? Well take your pick. Either Perl doesn't agree with your distinction between "valid syntax to name an element of a collective" and "valid syntax for a scalar name" or else Perl is sometimes unusually willing to accept the former in places where one would expect the latter. (I lean towards the second interpretation - after all one cannot use my just anywhere, nor can one get that to make any sense.)

Therefore if someone is willing to do the work and there is no ambiguity in the parsing, this feature could make it into Perl 5 and it wouldn't necessarily be a bad thing.

Incidental note. One cannot use local on a lexical. This is an utterly arbitrary limitation - the feature was once put in only to be taken out because it was felt that where it happened it was undoubtably a mistake.


In reply to Re: Re: Re: Re: Re: Re: Surpised by foreach iterator limitation by Anonymous Monk
in thread Surpised by foreach iterator limitation by shotgunefx

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 making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-19 18:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found