Jan 8, 2007 #1 timgerr IS-IT--Management Joined Jan 22, 2004 Messages 364 Location US I want to replace the last comma with nothing. Code: my $test = 'this,is,a,test,"; not user how do do this one. thanks -T -How important does a person have to be before they are considered assassinated instead of just murdered? -Need more cow bell!!!
I want to replace the last comma with nothing. Code: my $test = 'this,is,a,test,"; not user how do do this one. thanks -T -How important does a person have to be before they are considered assassinated instead of just murdered? -Need more cow bell!!!
Jan 8, 2007 #2 rharsh Technical User Joined Apr 2, 2004 Messages 960 Location US Something like this might work for you: Code: $test =~ s/(.+),/$1/; That hasn't been tested, but it should work. Upvote 0 Downvote
Something like this might work for you: Code: $test =~ s/(.+),/$1/; That hasn't been tested, but it should work.
Jan 9, 2007 #3 1DMF Programmer Joined Jan 18, 2005 Messages 8,795 Location GB or maybe this conveluted way Code: $test = substr($test,0,len($test)-1) . "?"; - lol "In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you. Upvote 0 Downvote
or maybe this conveluted way Code: $test = substr($test,0,len($test)-1) . "?"; - lol "In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
Jan 9, 2007 #4 KevinADC Technical User Joined Jan 21, 2005 Messages 5,070 Location US or simply: Code: $test =~ s/,$//; but if you know for sure there is a comma on the end that needs removing and there is no newline or something else: Code: chop($test); - Kevin, perl coder unexceptional! Upvote 0 Downvote
or simply: Code: $test =~ s/,$//; but if you know for sure there is a comma on the end that needs removing and there is no newline or something else: Code: chop($test); - Kevin, perl coder unexceptional!
Jan 11, 2007 #5 MikeLacey MIS Joined Nov 9, 1998 Messages 13,212 Location GB or... chop(chomp($test)); that will take of a newline if it's there Mike The options are: fast, cheap and right - pick any two. & Want great answers to your Tek-Tips questions? Have a look at faq219-2884 Upvote 0 Downvote
or... chop(chomp($test)); that will take of a newline if it's there Mike The options are: fast, cheap and right - pick any two. & Want great answers to your Tek-Tips questions? Have a look at faq219-2884