Remove an element from an array in perl
https://stackoverflow.com/questions/17216966/delete-elements-from-array-if-they-contain-some-string
CODE
my $input_Color = 'Green';
my @array = qw(Red Blue Green Yellow Black);
@array = grep {!/$input_Color/} @array;
print "@array";
KevinADC (TechnicalUser)15 Mar 05 03:49
another way without using a regexp:
CODE
my $input_Color = 'Green';
my @array = qw(Red Blue Green Yellow Black);
@array = grep {$_ ne $input_Color} @array;
print "@array";
好的心态+正确的方法
浙公网安备 33010602011771号