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" 

        If really a+2.8 then /a\+2\.8/ would be the split. The + has meaning in 
the regex as give me 1 or more a's. Also should \ the period since a+218 would 
be a valid split on a\+2.8 where the . says anything can be there.

Wags ;)
> Thanks,
> Prakash
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com



*******************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
*******************************************************


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to