Gossamer Forum
Home : General : Perl Programming :

Re: [delicia] remove element in array

Quote Reply
Re: [delicia] remove element in array In reply to
Something like this?


Code:
my $player_to_remove = "bevs";
my $test = q|delicia~~bevs~~golfer31~~nancy|;
my @new;
foreach (split /~~/, $test) {
next if $_ =~ /$player_to_remove/i;
push @new, $_;
}
my $new_users = join "~~", @new;

Basically just loop through the users you have, and skip if it matches the one you want to remove. Then re-join the strings and you have the new string without the one you removed :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Subject Author Views Date
Thread remove element in array delicia 2032 Jun 6, 2021, 1:18 PM
Thread Re: [delicia] remove element in array
Andy 1998 Jun 7, 2021, 8:50 AM
Post Re: [Andy] remove element in array
delicia 1984 Jun 7, 2021, 11:07 AM