Search notes:

Perl function: splice

#!/usr/bin/perl
use warnings;
use strict;

my @array = qw(zero one two three four five six seven);

my @two_to_five = splice @array, 2, 3;

print join "\n", @two_to_five;
# two
# three
# four

print "\n\n";
print join "\n", @array;
# zero
# one
# five
# six
# seven

@two_to_five = qw(foo bar baz);

splice @array, 1, 3, qw(Foo Bar Baz);

print "\n\n";
print join "\n", @array;
# zero
# Foo
# Bar
# Baz
# seven
Github repository about-perl, path: /functions/splice.pl

See also

Perl functions

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758207402, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Perl/functions/splice(69): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78