Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: Need help with removing values from arrays

by marinersk (Priest)
on Aug 15, 2017 at 11:16 UTC ( #1197415=note: print w/replies, xml ) Need Help??


in reply to Re^2: Need help with removing values from arrays
in thread Need help with removing values from arrays

Okay, I had a few minutes, so I added all the mystatements and provided some initializers to get around the error messages.

Your code still doesn't do anything:

#!/usr/bin/perl use strict; use warnings; my $str = "1,2,3,4,5"; my @array = (); my ($ids, $attri) = split /,/, $str; print " \$ids: [$ids]\n"; print " \$attri: [$attri]\n"; splice (@array,$ids, 1); print " \@array:\n"; my $array_index = 0; foreach my $array_element (@array) { print " [$array_index]: [$array_element]\n"; } print "Okay, now what?\n"; sub refreshdisplay{ my $id=0; my $arraylist = ""; for($id=0;$id<=$#array;$id++){ if($id == 0){ $arraylist = "$array[0]"; } else{ $arraylist .= "$id,$array[$id]\n"; } } }

Yields:

S:\Steve\Dev\PerlMonks\P-2017-08-15@0704-combobox>perl combobox0b.pl $ids: [1] $attri: [2] splice() offset past end of array at combobox0b.pl line 12. @array: Okay, now what? S:\Steve\Dev\PerlMonks\P-2017-08-15@0704-combobox>

Replies are listed 'Best First'.
Re^4: Need help with removing values from arrays
by Anonymous Monk on Aug 15, 2017 at 11:30 UTC
    > Okay, I had a few minutes, so I added all the my statements
    Not true, this post is one minute older than the last pointless one you made. adding all 4 mys must have really messed with your mind. What a saint, thanks for your amazing efforts so far.

      Helping someone to see not only what needs to change in how they ask questions, but also why it is necessary, requires a subtlety which apparently eludes you.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1197415]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2022-10-05 15:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (24 votes). Check out past polls.

    Notices?