Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: find common data in multiple files

by 1nickt (Monsignor)
on Dec 28, 2017 at 13:46 UTC ( #1206322=note: print w/replies, xml ) Need Help??


in reply to Re: find common data in multiple files
in thread find common data in multiple files

Don't do this:
$result{$key} = 1; $result{$key}++;
... (In the code as written, the value can never be anything but 1.)

Sorry, that's wrong.

$ perl -E '$key = "wrong"; $result{$key} = 1; $result{$key}++; say val +ues %result'
2


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^3: find common data in multiple files
by Anonymous Monk on Dec 28, 2017 at 23:56 UTC
    "So, sue me ..." ... two!
    Nevertheless, not the increment-behavior that the programmer intended, which was the essential point. The value will always be one two.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1206322]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2018-06-23 05:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (125 votes). Check out past polls.

    Notices?