%seen is a hash. map is constructing a list of key-value pairs to assign to it. Each element of @serv is a key, and 1 is the value for each. It's the same as saying
my %seen;
@seen{@serv} = (1) x @serv;
Saying "doesn't seem to be working" is not useful. Providing your input, output, and what you expected to be different could help.
Please do note the advice to chomp the lines you're reading from a file. "foo\n" will not be equal to "foo".
We're not really tightening our belts, it just feels that way because we're getting fatter.
|