It has already been noted in your previous thread that a set of arrays is a poor choice of data structure for your task. Difficulty of deleting a record is one problem of many that you'll encounter - it's much easier using hashes.

#!/usr/bin/env perl use v5.12; use Data::Dumper; my %students = ( x1 => { name => "Alice", telephone => 1001, regno => "x1", }, x2 => { name => "Bob", telephone => 1002, regno => "x2", }, x3 => { name => "Carol", telephone => 1003, regno => "x3", }, ); say "Let's look at the data structure..."; print Dumper \%students; say "What is student x1's telephone number?"; say $students{x1}{telephone}; say "What is Carol's telephone number?"; my ($carol) = grep { $_->{name} eq "Carol" } values %students; say $carol->{telephone}; say "Now let's delete student x2..."; delete $students{x2}; say "And change Carol's phone number"; $carol->{telephone} = "1004"; say "Let's look at the data structure again..."; print Dumper \%students;
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

In reply to Re: How can one delete an element and it corresponding values from the array of arrays? by tobyink
in thread How can one delete an element and it corresponding values from the array of arrays? by supriyoch_2008

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.