Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: substitute within elements of array

by choroba (Abbot)
on Apr 09, 2013 at 09:24 UTC ( #1027684=note: print w/ replies, xml ) Need Help??


in reply to substitute within elements of array

Works for me. What exactly is in the @array?

#!/usr/bin/perl use warnings; use strict; my @array = qw/what what? what. what!/; foreach my $word (@array) { $word =~ s/(\.|\?|\!)$//; } foreach my $word (@array) { print "$word\n"; }

Output:

what what what what
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re: substitute within elements of array
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (12)
As of 2014-09-03 08:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (35 votes), past polls