Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: I am confused by a "Learning Perl" sample showing "unshift"

by haukex (Archbishop)
on Jan 22, 2021 at 22:23 UTC ( [id://11127312]=note: print w/replies, xml ) Need Help??


in reply to I am confused by a "Learning Perl" sample showing "unshift"

I expected "unshift @lArray, @lNums" to expand to "unshift @lArray, 1 2 3" and then be processed as though

The first part is correct (the contents of the @lNums array becomes part of the argument list to unshift), and as for the second part, note it's very simple to express what you thought would happen using Statement Modifiers: unshift @lArray, $_ for @lNums;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-03-29 13:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found