develooper Front page | perl.beginners | Postings from March 2002

Re: remove a char

Thread Previous | Thread Next
From:
John W. Krahn
Date:
March 29, 2002 00:35
Subject:
Re: remove a char
Message ID:
3CA4270E.4A7E590F@acm.org
Michael Gargiullo wrote:
> 
> In an array say @randomWord
> 
> The second position could contain one of a thousand words, but the words all
> end with a comma.  How can I strip that comma?
> 
> I've tried using:
> 
> $_=$randomWord[1];
> /(.*.),/;
> $randomWord[1] = $_;
> 
> But this is not working, any sugestions?


$randomWord[1] =~ tr/,//d;


John
-- 
use Perl;
program
fulfillment

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About