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:
A small question

 



JFrost
Novice

Jul 25, 2001, 11:46 AM

Post #1 of 3 (497 views)
A small question Can't Post

Hi,

I have a string that looks something like this.

$datastring = "~~Data1~~Data2~~Data3";

How can I search to see if the first 2 characters are "~~". If it is, remove them (only the first 2 "~~") from the string.

Thanks



mhx
Enthusiast / Moderator

Jul 25, 2001, 12:12 PM

Post #2 of 3 (492 views)
Re: A small question [In reply to] Can't Post

You could use the following regex:

Code
$datastring =~ s/^~~//;

-- Marcus


Code
s$$ab21b8d15c3d97bd6317286d$;$"=547269736;split'i',join$,,map{chr(($*+= 
($">>=1)&1?-hex:hex)+0140)}/./g;$"=chr$";s;.;\u$&;for@_[0,2];print"@_,"



JFrost
Novice

Jul 25, 2001, 12:58 PM

Post #3 of 3 (489 views)
Re: A small question [In reply to] Can't Post

It worked


Thanks a lot.


 
 


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

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