Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7604703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:58:53+00:00 2026-05-30T23:58:53+00:00

I wanted to run a code that continuosuly checks if a file exits if

  • 0

I wanted to run a code that continuosuly checks if a file exits if it exists then checks the files’ MD5 against the previous MD5 . If there is some changes then it executes some code.
But the perl MD% seems to be changing every time I call the hexdigest for the same file.
Does MD5 change everytime ?

I intially had

$md5 = Digest::MD5->new; 

before while(1)

If this is not how it is to be done is there anything else to achieve my intentions ?
Thanks

while(1)
{
    if(!(-e $config_file)){
            next;
    }else{
            $md5 = Digest::MD5->new;
            $md5->addpath($config_file);
            print "<->";
            print $md5->hexdigest;

            $value=($digest eq $md5->hexdigest ? 1 : 0);
            if($value==1)
            {
                    next;
            }else
            {
                    $digest=$md5->hexdigest;
            }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T23:58:54+00:00Added an answer on May 30, 2026 at 11:58 pm

    The hexdigest operation is read-once, meaning that after you execute it, the value is reset. It can be read only once, but you attempt to read it twice. Store it in a temporary when you read it the first time.

    From the documentation (my emphasis):

    $md5->digest

    Return the binary digest for the message. The returned string will be 16 bytes long.

    Note that the digest operation is effectively a destructive, read-once operation. Once it has been performed, the Digest::MD5
    object is automatically reset and can be used to calculate another
    digest value. Call $md5->clone->digest if you want to calculate the
    digest without resetting the digest state.

    $md5->hexdigest

    Same as $md5->digest, but will return the digest in hexadecimal form. The length of the returned string will be 32 and it will only
    contain characters from this set: ‘0’..’9′ and ‘a’..’f’.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just wanted some opinions from people that have run Selenium ( http://selenium.openqa.org )
I have a program that I run through the command line and I wanted
Wanted to know if someone had a suggestion on code or maybe there's a
I'm writing code that is part of an automation system. I wanted to add
I've inherited some code and wanted to run this modification by you all, my
I was finishing up a code mod and wanted to run my program through
Is there a way i could run php code in facebook fan page. Basically
I'm writing code that deals with a file that uses hashes. I need to
I want to run some code after loading my custom file, but I want
I wanted to run 1,000 iterations of a program, so set a counter for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.