Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Perl / Getting Started / July 2008



Tip: Looking for answers? Try searching our database.

removing '*' from *****STAFF*****

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Manasi Bopardikar - 03 Jul 2008 05:51 GMT
Does anyone know how do I remove the beginning and the trailing * from
*****STAFF*****



Thanks  and Regards,

Manasi Bopardikar|s/w Engineer|Persistent SystemsLtd

(+91)(020)(30234497)|9767218759

manasi_bopardikar@persistent.co.in



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.
Enigma - 03 Jul 2008 05:57 GMT
> Does anyone know how do I remove the beginning and the trailing * from
> *****STAFF*****
[quoted text clipped - 16 lines]
>
>  
$var =~ s/\*$//;

Signature

To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Enigma - 03 Jul 2008 05:59 GMT
>> Does anyone know how do I remove the beginning and the trailing * from
>> *****STAFF*****
[quoted text clipped - 24 lines]
>>  
> $var =~ s/\*$//;

oh and $var =~ s/^\*//;

Signature

To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Rob Dixon - 03 Jul 2008 16:08 GMT
>> Does anyone know how do I remove the beginning and the trailing * from
>> *****STAFF*****
[quoted text clipped - 17 lines]
>>  
> $var =~ s/\*$//;

s/^\*+//, s/\*+$// for $var;

Rob

Signature

To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

John W. Krahn - 03 Jul 2008 06:07 GMT
> 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
Signature

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: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Rajnikant - 03 Jul 2008 06:49 GMT
Try out this,

my $stuff = '*****STAFF*****';
$stuff =~ s/\*//g;
Print $stuff;

Regards,
Rajnikant Jachak

-----Original Message-----
From: John W. Krahn [mailto:jwkrahn@shaw.ca]
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: beginners-unsubscribe@perl.org For additional
commands, e-mail: beginners-help@perl.org http://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.

Signature

To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Amit Saxena - 03 Jul 2008 08:41 GMT
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

> Try out this,
>
[quoted text clipped - 49 lines]
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
Nayab - 03 Jul 2008 11:54 GMT
> Hi Rajnikant,
>
[quoted text clipped - 63 lines]
>
> - Show quoted text -

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

Signature

To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

John W. Krahn - 04 Jul 2008 03:57 GMT
> my $test = "*****STAFF*****";
> if ($test =~ /(\*{1})(.*)(\*{1})/) {

Could be more simply written as:

if ($test =~ /\*(.*)\*/) {

> $test = $1;
> }

John
Signature

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: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.