Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Removing chars from a word from an array

by superfrink (Curate)
on Jan 25, 2006 at 03:56 UTC ( [id://525365]=note: print w/replies, xml ) Need Help??


in reply to Removing chars from a word from an array

Update:murugu already posted this solution and blazar suggested using a character class in the regex.

#!/usr/bin/perl -w use strict; # input from ikegami my $word = 'abracadabra'; my @list = qw( a b c d e ); my $pattern = join("|" , @list); print "pattern: $pattern\n\n"; print "before: $word\n"; $word =~ s/$pattern//g; print "after : $word\n";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://525365]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-04-20 04:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found