CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
strip first slash

 



mmcw
User

Dec 2, 2001, 12:33 AM

Post #1 of 4 (462 views)
strip first slash Can't Post

How to strip a first slahs from the beginning from line.

For example: /home/cgi-bin/ShopSecure/index.html
has to become: home/cgi-bin/ShopSecure/index.html

Michel



Jean
User


Dec 2, 2001, 1:49 AM

Post #2 of 4 (461 views)
Re: strip first slash [In reply to] Can't Post

Say, the string is inside a $str variable:
$str =~ s#/##;

Jean Spector
QA Engineer @ mSAFE Ltd.
jean.spector@softhome.net


wickedxter
User

Dec 2, 2001, 7:33 AM

Post #3 of 4 (458 views)
Re: strip first slash [In reply to] Can't Post

here you go $text =~ s/^\///;



Jean
User


Dec 3, 2001, 2:49 AM

Post #4 of 4 (452 views)
Re: strip first slash [In reply to] Can't Post

Man, I blew it - instead of copy&paste I typed it manually and Blush missed the ^ .
I'm ashamed...

Jean Spector
QA Engineer @ mSAFE Ltd.
jean.spector@softhome.net

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives