prakash m wrote: > I have written a small code which will just try to split a string based on > the Key. > ----------------- > $val="sample1a+2.8sample2a+2.8sample3a"; > print "String=$val\n"; > print "split Key: 2.8\n"; > @arr=split(/2.8/,$val); > foreach $i (@arr) > { > print "**Split value: $i\n"; > } > print "******************\n"; > print "split Key: a+2.8\n"; > @arr1=split(/a+2.8/,$val); > foreach $j (@arr1) > { > print "**Split value: $j\n"; > } > ---------------- > The first case the key is 2.8 and the output is correct, but if i want to > split the string based on key "a+2.8" > it's giving an improper result. > String=sample1a+2.8sample2a+2.8sample3a > split Key: 2.8 > **Split value: sample1a+ > **Split value: sample2a+ > **Split value: sample3a > ****************** > split Key: a+2.8 > **Split value: sample1a+2.8sample2a+2.8sample3a > Can anyone tell me what changes are needed to split the string based on > "a+2.8"
backwhack the '+' (ie. "\+") -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>