Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Is this a bug, or expected behavior?

by BrowserUk (Patriarch)
on Mar 17, 2006 at 15:38 UTC ( [id://537476]=note: print w/replies, xml ) Need Help??


in reply to Is this a bug, or expected behavior?

$a->[ 1.. 4 ] is not valid array slice syntax. You need an @ in there for it to be so:

[0] Perl> $a = [ qw(mary had a little lamb with mint jelly) ];; [0] Perl> $b = [ @{ $a }[ 1 .. 4 ] ];; [0] Perl> print @$b;; had a little lamb

I'm surprised that you didn't get a warning or two along the lines of:

Using an array as a reference is deprecated at ... Argument "" isn't numeric in array element at ...

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-03-28 14:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found