I am curious to know more on UTF and understand related issues that may
creep in my algorithm. Could someone please shed some light on it.

Can I use following:

use Encode;

while(<$sample_file_fh>){

    # Encoding into utf data
    $utf_data = encode("utf8", $_);
    $data_string = $data_string.$utf_data;
}


# Checking the current length of the string
while(length($data_string)<$total_size){
    $data_string = $data_string.$data_string;
}

And finally printing $data_string to the O/P file handle

I am just learning to handle UTF data so feel free to correct me. :)

Cheers,
Parag




On Sun, Jan 3, 2010 at 2:07 PM, Shlomi Fish <shlo...@iglu.org.il> wrote:

> On Sunday 03 Jan 2010 07:12:32 Parag Kalra wrote:
> > Thanks Shlomi for your expert comments and I must admit you have got a
> very
> > strong vision. :)
> >
>
> You're welcome.
>
> > Anyways coming to my first question:
> > > a.) What do I need to do to make sure that length of new file will
> >
> > increase
> >
> > > every time the step 4 is executed.
> >
> > Although it may have nothing to do with this algorithm but I still
> thought
> > of discussing it.
> >
> > Say I have scripts that dumps some contents on to an output file handler
> > inside a long loop. With such scripts I have noticed 2 types of
> behaviour.
> >
> > 1. The size of this output file is zero while the script is getting
> >  executed inside the loop and it increases only when the script execution
> >  gets over.
> >
> > 2. And sometimes I have noticed that the size of output file increases
> >  every time some data is dumped on to it. Thus increase in size happens
> in
> >  real/run time.
> >
> > I want to control this behaviour. What I can guess is that it has
> something
> > to do with output buffer.
> >
>
> Please read "Suffering from Buffering":
>
> http://perl.plover.com/FAQs/Buffering.html
>
> Regards,
>
>        Shlomi Fish
>
> --
> -----------------------------------------------------------------
> Shlomi Fish       http://www.shlomifish.org/
> Optimising Code for Speed - http://shlom.in/optimise
>
> Bzr is slower than Subversion in combination with Sourceforge.
> ( By: http://dazjorz.com/ )
>

Reply via email to