Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

(tye)Re2: [substr] anomaly or mine?

by tye (Sage)
on Aug 20, 2002 at 00:53 UTC ( [id://191357]=note: print w/replies, xml ) Need Help??


in reply to Re: Re^3: [substr] anomaly or mine?
in thread [substr] anomaly or mine?

Well, @a[1..3]= "x" is the same as @a[1..3]= ( "x", undef, undef ), and so this seems reasonable to me. [ Note that scalar context changes things since list assignment is documented to return the number of items in the right-hand-side list when evaluated in a scalar context so 1 == scalar( @a[1..3]= "x" ). ]

If there were a way to assign to some kind of variable-length array slice, then we could make a more appropriate comparison between it and the substr "bug" case.

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re: (tye)Re2: [substr] anomaly or mine?
by BrowserUk (Patriarch) on Aug 20, 2002 at 01:09 UTC

    Agreed tye, my bad. If you take a look at my updated version, once I remembered the syntax for slices (not so very hard) it actually made the point I set out to make in the first place. That yo can use a slice as an rvalue in a list context and get the result that you would expect!

    I spent 2 hours verifying the original bug and chose to post rather than mention it in the CB cos I often get extreme lag as you saw earlier. I end up trying to answer the question before the last question asked etc.

    Then I had a brainfart ........


    What's this about a "crooked mitre"? I'm good at woodwork!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://191357]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-19 03:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found