There are a number of different solutions for this...I'm not sure which is the most efficient.
1.) $var = reverse( <> ); if( $var =~ /^[^_]*?_[^_]*?_)(.*)$/ ) { ($temp = $2) =~ tr/_//d; $var = reverse( $1 . $temp); } print $var; 2.) $var = <>; $var =~ s/_// while $var =~ /_.*?_.*?_/g; print $var Good luck! Tanton -----Original Message----- From: HANSON To: [EMAIL PROTECTED] Sent: 12/3/2001 12:39 AM Subject: removing underscores based on quantity Hi! I need to remove the first n underscores from various strings if there are more than two currently present in the string. The total number of underscores will vary. For example, if I have the following strings: $a = "Now_is_the_time_for_all" $b = "The_quick_brown_fox_jumped" $c = "foo_bar_baz" I need to change them to: $a = "Nowisthetime_for_all" $b = "Thequickbrown_fox_jumped" $c = "foo_bar_baz" # No change required. Any ideas? Thanks! /Mark -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]