On Jul 3, 12:41 pm, [EMAIL PROTECTED] (Amit Saxena) wrote:
> Hi Rajnikant,
>
> That removes the character "*" for everywhere whereas the requirement is
> only to remove from the
> beginning and trailing parts of the string.
>
> Regards,
> Amit Saxena
>
> On Thu, Jul 3, 2008 at 11:19 AM, Rajnikant <
>
>
>
> [EMAIL PROTECTED]> wrote:
> > Try out this,
>
> > my $stuff = '*****STAFF*****';
> > $stuff =~ s/\*//g;
> > Print $stuff;
>
> > Regards,
> > Rajnikant Jachak
>
> > -----Original Message-----
> > From: John W. Krahn [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, July 03, 2008 10:38 AM
> > To: Perl Beginners
> > Subject: Re: removing '*' from *****STAFF*****
>
> > Manasi Bopardikar wrote:
> > > Does anyone know how do I remove the beginning and the trailing * from
> > > *****STAFF*****
>
> > my $stuff = '*****STAFF*****';
>
> > s/^\*+//, s/\*+$// for $stuff;
>
> > Or if you want to remove all * regardless of where in the string they are
> > located:
>
> > $stuff =~ tr/*//d;
>
> > John
> > --
> > Perl isn't a toolbox, but a small machine shop where you can special-order
> > certain sorts of tools at low cost and
> > in short order.                            -- Larry Wall
>
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
> > commands, e-mail: [EMAIL PROTECTED]://learn.perl.org/
>
> > DISCLAIMER
> > ==========
> > This e-mail may contain privileged and confidential information which is
> > the property of Persistent Systems Ltd. It is intended only for the use of
> > the individual or entity to which it is addressed. If you are not the
> > intended recipient, you are not authorized to read, retain, copy, print,
> > distribute or use this message. If you have received this communication in
> > error, please notify the sender and delete all copies of this message.
> > Persistent Systems Ltd. does not accept any liability for virus infected
> > mails.
>
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >http://learn.perl.org/- Hide quoted text -
>
> - Show quoted text -

my $test = "*****STAFF*****";
if ($test =~ /(\*{1})(.*)(\*{1})/) {
$test = $2;
}


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to