On Sep 24, David Samuelsson (PAC) said: >i want to remove certain elements from it: >so i ran: > for (@array){ > s/$current_user.*//; > } > >nw when i print it, all $current user are gone as i wanted, but its a big >space in the array instead. like:
No, it's not a "big space", you just haven't removed the element. @array = qw( what a funny joke ); $array[2] = ''; # doesn't REMOVE 'funny', just makes it '' instead print "@array"; # what a joke You'll want to use grep(): @array = grep !/\Q$current_user/, @array; But be careful. If you have a user named foobar, and a user names ooba, and you remove all elements containing 'ooba', you'll also remove all elements containing 'foobar', since 'foobar' contains 'ooba'. Maybe you want to use @array = grep !/^\Q$current_user\E\b/, @array; -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]