use Inline 'C'; my @ary = ('aa'..'az', 'aj'); my $rc = remove_str( \@ary, 'aj' ); print"$rc\n@ary\n"; __END__ __C__ int remove_str( SV* av_ref, SV* remove ) { AV* terms; SV* element; I32 num, i; STRLEN len; int retval = 0; terms = (AV *)SvRV(av_ref); num = av_len(terms); for( i=0; i<=num; i++ ) { element = av_shift(terms); if( strcmp( SvPV(element,len), SvPV(remove,len) ) ) av_push(terms, element); else retval++; } return retval; }