perlsyn is always good reading material.dos>perl -MO=Deparse -e"splice @cities, (@cities-@states)+1, 0, shift +@states for 0 .. @states-1;" for 0 .. @states-1;" foreach $_ (0 .. @states - 1) { splice @cities, @cities - @states + 1, 0, shift @states; } -e syntax OK dos> dos> dos>more eff @cities = (Atlanta, Birmingham, Chicago, Memphis, "New York"); @states = (GA, AL, IL, TN, NY); print "Cities: @cities" . "\n"; print "States: @states" . "\n"; splice @cities, (@cities-@states)+1, 0, shift @states for 0 .. @states +-1; print "@cities" . "\n"; dos> dos> dos>perl -MO=Deparse eff @cities = ('Atlanta', 'Birmingham', 'Chicago', 'Memphis', 'New York'); @states = ('GA', 'AL', 'IL', 'TN', 'NY'); print "Cities: @cities" . "\n"; print "States: @states" . "\n"; foreach $_ (0 .. @states - 1) { splice @cities, @cities - @states + 1, 0, shift @states; } print "@cities" . "\n"; eff syntax OK dos>
___crazyinsomniac_______________________________________
Disclaimer: Don't blame. It came from inside the void
perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"
In reply to (crazyinsomniac) Re: splice and for loop together??
by crazyinsomniac
in thread splice and for loop together??
by Wyman G
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |