Re: perl on strings

2007-04-19 Thread John W. Krahn
yitzle wrote: > $strings = qw/Formatting_l_cs.cat Formatting_l_da.cat > Formatting_l_de.cat Formatting_l_zh-tw.cat/; You are assigning a list to a scalar so that is equivalent to: $strings = 'Formatting_l_zh-tw.cat'; > my $partStrings = ( $strings =~ /_.*?\./ )[0]; # Minimun from _ to . The exp

Re: perl on strings

2007-04-19 Thread John W. Krahn
Nishi wrote: > Hi: Hello, > I have a strings such as > Formatting_l_cs.cat > Formatting_l_da.cat > Formatting_l_de.cat > Formatting_l_zh-tw.cat > I need to extract the substring before the "." and after the last occurence > of "_" ie in the above cases, it would return "cs" or zh-tw" etc. > > Ho

Re: perl on strings

2007-04-19 Thread Rob Dixon
Nishi wrote: Hi: I have a strings such as Formatting_l_cs.cat Formatting_l_da.cat Formatting_l_de.cat Formatting_l_zh-tw.cat I need to extract the substring before the "." and after the last occurence of "_" ie in the above cases, it would return "cs" or zh-tw" etc. How can I achieve this? HT

Re: perl on strings

2007-04-19 Thread yitzle
$strings = qw/Formatting_l_cs.cat Formatting_l_da.cat Formatting_l_de.cat Formatting_l_zh-tw.cat/; my $partStrings = ( $strings =~ /_.*?\./ )[0]; # Minimun from _ to . This code is untested. The RegEx should work but the rest... not sure. It would work in a loop, though. Can someone explain why