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:
Removing portions of a string

 



dolfantimmy
New User

Jan 24, 2014, 12:06 PM

Post #1 of 3 (793 views)
Removing portions of a string Can't Post

I have an array of scalar values. The all start with the same thing. I want to remove that repetitive data and leave only the remaining text.

For simplicity, suppose I have a scalar value

$a="Repeated Text - X213123";

I know with regex I can use s/Repeated Text - //g

How do I do this in perl?


FishMonger
Veteran / Moderator

Jan 24, 2014, 12:13 PM

Post #2 of 3 (792 views)
Re: [dolfantimmy] Removing portions of a string [In reply to] Can't Post


Code
$var =~ s/^Repeated Text - //;



dolfantimmy
New User

Jan 24, 2014, 12:22 PM

Post #3 of 3 (789 views)
Re: [FishMonger] Removing portions of a string [In reply to] Can't Post

Do, wow, so obvious. Thanks!

 
 


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

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