Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
First, thanks for your comment.

Now, on to what I originally wrote, which may sound snippy -- it's not meant to be.

Right. Well. That's a bit cryptic, though, no?

Further, 2nd Ed of Programming Perl provides that the first line is "Same as" as well. I'm not here to nitpick about right or wrong, though. Perhaps a line in perldata someplace that says "hash slices are lists" would clear things up.

Honestly, I find this behavior a bit odd. With a list, evaluated in a scalar context so that it returns its last value, you could at least have things going on prior to the last value that are meaningful in determining the last value (much like constructs in C with the comma operator).

By the time you shove stuff into an array, or hash, and then pull out a slice, it makes more sense to me for this to be more "array like" than "list like"; the values before the last one are then in the dreaded void context if this object is then evaluated in a scalar context.

That is definitely enough musing from me about what is, to me, a very dusty little corner of perl.


In reply to Re: Re: Re: Re: Hash slices ? by snax
in thread Hash slices ? by ChOas

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: (5)
As of 2024-03-29 10:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found