in reply to Re: md5_hex gives different values for same string
in thread md5_hex gives different values for same string

changing =~ to eq does change the outcome but ive used chomp on both $cmd and $check before i use md5_hex and it still doesnt work.

Replies are listed 'Best First'.
Re^3: md5_hex gives different values for same string
by monarch (Priest) on Oct 10, 2006 at 13:26 UTC
    It would be logical that chomp isn't behaving the way you'd expect. Perhaps use regular expressions that explicitly state what you're trying to do until you're comfortable with how chomp functions. Or even write a function of your own.. e.g.
    sub remove_trailing_newlines( $ ) { my ( $stringref ) = @_; ${$stringref} =~ s/[\r\n]+\z//gs; }
    . Then call it instead of chomp. E.g.
    remove_trailing_newlines( \$cmd ); remove_trailing_newlines( \$check );
      sorted...
      $check =~ s/[\r\n]+\z//gs;
      thanks again.
Re^3: md5_hex gives different values for same string
by Anonymous Monk on Oct 10, 2006 at 13:29 UTC
    You're supposed to use eq, so just use eq.