Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Calling splice() on Immutable Arrays

by SankoR (Prior)
on Jul 13, 2016 at 01:59 UTC ( [id://1167665]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        my @a = qw[a simple list];
        Internals::SvREADONLY(@a,    1);
    ...
        splice(@a, 1, 1, 'spliced');
        warn join ' ', @a;               
        warn '$a[1] is ' . (Internals::SvREADONLY($a[1]) ? '' : 'not ') . 
    +'read-only';
    
  2. or download this
        my @b = qw[another simple list];
        Internals::SvREADONLY(@b, 1);# Matters here
    ...
        warn join ' ', @b;           # "another simple list"
        splice(@b, 1, 1);            # Zot!
        warn join ' ', @b;           # "another list"
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1167665]
Front-paged by BrowserUk
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: (2)
As of 2024-04-25 06:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found