perl lacks the n of sh's "shift n"

D

Dan Jacobson

Is it no great loss that perl lacks the n of sh's "shift n"?
I suppose there are two cases, one where we are sure we can indeed
shift n times, use for (1..$n){shift @F} I suppose, and one where we are
worried we will run out of parameters.
 
U

Uri Guttman

DJ> Is it no great loss that perl lacks the n of sh's "shift n"?
DJ> I suppose there are two cases, one where we are sure we can indeed
DJ> shift n times, use for (1..$n){shift @F} I suppose, and one where we are
DJ> worried we will run out of parameters.

you are mistaken.

perldoc -f splice

shift and friends can all be emulated (albeit slower) by splice.

uri
 
J

Jürgen Exner

Dan said:
Is it no great loss that perl lacks the n of sh's "shift n"?
I suppose there are two cases, one where we are sure we can indeed
shift n times, [...]

Maybe you missed the splice() function?

jue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top