tags:

views:

23

answers:

1

1)For example::I have a $string ="abc hell_+o w343r2d -000 rebotin".Using search pattern and regular expression is there any way to remove or chop -000 from the string in PERL. 2)I want to begin learning regular expression with examples in simple means.Which is the best tutorial to start with???

+1  A: 
$string = "foobar";
$string =~ s/bar/baz/g;

print $string would then yield "foobaz"

the s/foo/bar/g syntax is called search and replace. The first item is the thing to search for, second item is the thing to replace it with.

in your case, you'd want the replace clause to be empty for removing things. $string =~ s/-000//g would remove -000 completely.

Blaine LaFreniere
Same as my answer but more detailed so +1.
paxdiablo