http://www.perlmonks.org?node_id=1045257


in reply to Parsing a sentence based on array list

Hi neversaint

Here is one of the way to remove the strings matched in the line from the array.

use strict; use warnings; use Data::Dumper; my $line ='Lorem ipsum dolor sit amet, consectetur adipisicing elit'; my @array1 = ('ipsum', 'sit amet', 'elit'); foreach(@array1) { $line =~ s/$_//g; } print $line;

All is well