in reply to how to ignore ' in an array

Are you trying to ignore items in an array that have a single quote, or are you trying to rmeove single quotes from a string? If the first, than in general anything involving "ignoring X from array" means grep. If the second, note that you'll want the /g modifier so the substitution is done more than once.
# removing items from array: my @values = ( "stuff", "has'some'quotes", "foo" ); @values = grep( $_ !~ /'/, @values ); # removing single quotes from a string: my $string = "has'some'quotes\nand a second'line'of stuff"; $string =~ s/'//sg;

Replies are listed 'Best First'.
Re^2: how to ignore ' in an array
by inman (Curate) on Aug 03, 2005 at 16:07 UTC
    If you are just removing characters from an array of words, just tr and map.
    my @data = qw ('hello world' wondered o'brian!); print "Before: @data\n"; map {tr/'//d} @data; print "After: @data\n";
A reply falls below the community's threshold of quality. You may see it by logging in.