in reply to Re: Using a regex function from a hash
in thread Using a regex function from a hash
my @view = ("ignore","ignore","dont\\ignore\\this.vms","ignore"); my %functions_hash = ( "\.vms" => [ qr/\\/, "" ] ); foreach my $data (@view) { while ((my $key, my $value) = each %functions_hash) { if( $data =~ /$key/ ) { my ( $match, $substitute ) = @{$value}; $data =~ s/$match/$substitute/g; print "data is now $data\n"; } } }
|
---|