in reply to exists EXPR error

Try replacing the line if ( exists %new_list{$file} ) { with if ( exists $new_list{$file} ) {, and the line if ( exists %old_list{$file} ) { with if ( exists $old_list{$file} ) {.

Hope that helps.

Replies are listed 'Best First'.
Re^2: exists EXPR error
by smturner1 (Sexton) on Dec 15, 2014 at 05:09 UTC

    I am pretty sure that is what I have:

    You suggested, "{ if ( exists $new_list{$file} ) {"

    The code is broken into two lines to improve readability, but all of the code you suggested is present. Unless I am missing something!

    sub DirCompare{ for my $file ( keys %old_list ) { if ( exists %new_list{$file} ) { next; } else { push @diffs, "Old file not in new: $file"; } } for my $file ( keys %new_list) { if ( exists %old_list{ $file } ) { next; } else { push @diffs, "Old file not in new: $file"; } }

      Contrast:if ( exists %new_list{$file} ) {

            with:if ( exists $new_list{$file} ) {

      Can you see.............^.....the difference?


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        I see it now. Sorry.

        It cleared the error. Now I get to go to the next error! I love learning Perl (at least that is what I am telling myself:)).

        Thanks for your help