very thanks for such clear answer. Ya, I understand that regex now. I am grouping all the string expect last element (By using pipe). And the grouped string saved into $1 by using "(".
$str =~ s/(.*)\|.*\|.*/$1/;now it will remove the last two elements. and it continues. Suppose if I have 60 "|" in my string and I want to delete last 22 then how can I use this. I cant write 22 pipes like "\|.*\|.*".
In reply to Re^4: how to remove a string from end of a line
by ravi45722
in thread how to remove a string from end of a line
by rpinnam
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |