Anisha Parveen wrote:
> Anisha Parveen wrote:
>> 
>>  I am a newbie to Perl scripting. I have a script file, with a statement as
>> below, which i find takes 1sec to execute. As this is called several times
>> in the script program, this is resulting in a significant delay in the
>> program.
>>
>>  As i am new to the scripting language , i am unable to figure out why does
>> this statement exection takes so much time.
>>
>>     my $Tmpstr = `$path $HOME/bin/*crypt* -e -f $_keyfilEOF
>> $str
>> EOF`;
>>
>>  I have given a print statement above this line in the script file and when
>> i give another print statement inside the main of 'crypt' i see it takes one
>> second, just to enter into the main of that application.
>>
>>  Can someone provide some pointers into what exactly is done by this
>> portion of the above statement,
>>
>> <<EOF
>> $str
>> EOF`;
>>
>
> To be noted :
>   This delay is noted only when the program is run in Solaris machine and
> not in Red Hat Linux.
> 
>    ALso the delay is not caused by the crypt application..since it takes one
> second jus to enter into the main of the crypt program.

What is the content of $path? My guess is that the delay is caused by accessing
a networked path - a  process that has to be repeated every time the line is
executed as the backticks create and destroy a separate process.

I suggest that you should use the Crypt::UnixCrypt module instead of shelling
out to the utility. I have never tried it myself, but it is bound to make your
program faster and will improve its portability.

Rob

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to