Yes thanks it is working fine in cases where there is space before/after =

But what if there is space before and after varable name, i.e

                  after_click_color                           =
cc6600

in this case I do it will fail...
 I need the output as
$recField[0] as after_click_color
$recField[1] as cc6600

Thanks
Anish




----- Original Message -----
From: "Michael David" <[EMAIL PROTECTED]>
To: "Anish Kumar K." <[EMAIL PROTECTED]>; "beginners perl"
<[EMAIL PROTECTED]>
Sent: Friday, November 19, 2004 12:06 PM
Subject: Re: variable space


> Try this....
>
> @recField = split /\s*=\s*/, $_;
>
>
> ----- Original Message -----
> From: "Anish Kumar K." <[EMAIL PROTECTED]>
> To: "beginners perl" <[EMAIL PROTECTED]>
> Sent: Friday, November 19, 2004 5:30 PM
> Subject: variable space
>
>
> Hi
>
> Suppose this is the line
> after_click_color = cc6600
>
>
> if I use
> @recField=split(/=/,$_);
>
> I will get
>
> $recField[0] as after_click_color
> and
> $recField[1] as cc6600
>
> If there is space before/after = that will also be involved..What if I
don;t
> wanted the space..I wanted to trim out the spaces before and after =
>
> Special case: There may be case like words follwoing ....In those the
spaces
> b/w words need not be trimmed..I just wanted the remove the space before
and
> after =
>
> after_click_color = This is test
>
> What is the solution
>
> I tried
> $recField[0] =~  s/" "//g;
>
> This is not helping..Please suggest a way...Any functions acailable..
>
> A
>
> Thanks
> Anish
>
>
>
>
>
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>



-- 
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